FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
[WD22] Help with Regex
[WD22] Help with Regex
Débuté par Wahib Hassaini, 19 juil. 2018 15:38 - 2 réponses
Connectez-vous…
Wahib Hassaini
#1
Posté le 19 juillet 2018 - 15:38
Hello,
I'm having a hard time with regex.
I need to isolate parts with a certain color in a RTF field.
Here is my source :
Quote
{\
tf1\ansi\ansicpg1252\deff0\
ouicompat\deflang1033{\onttbl{\0\nil\charset0 Tahoma;}}
{\colortbl ;\
ed0\green0\lue0;\
ed64\green85\lue141;\
ed0\green30\lue196;}
{\*\generator Riched20 10.0.17134}\viewkind4\uc1
\pard\cf1 Elem1\cf2 Hello \cf3 Elem2\par
2nd Liane : \cf3 Elem3\cf2\par
\cf3 Elem4\cf2 3rd\cf3 Elem5\cf2 Line : \cf3 Elem6\cf2\par
4th Line : \cf1 Elem7\cf0\par
}
Here is my regex :
(?<=\\cf[13] ).*?(?=\\cf.)
It's working just fine on those sites :
https://regex101.com/
,
https://www.regextester.com/
,
https://regexr.com/
But not in Windev...
Do you have an idea why?
Thank you.
Signaler
0
0
Fabrice Harari
#2
Posté le 19 juillet 2018 - 15:52
Hi Wahib,
probably because supported regex expressions in wlanguage are way less advanced than on these web sites.
You can certainly ask the support about the difference in behavior for a definite answer about it.
Best regards
Signaler
0
0
Tim
#3
Membre enregistré
34 messages
Popularité : +3 (3 votes)
Posté le 20 juillet 2018 - 14:27
Hi,
check out these links:
https://forum.pcsoft.fr/fr-FR/pcsoft.us.windev/45571-wd18-need-help-with-regular-expression/read.awp
https://forum.pcsoft.fr/fr-FR/pcsoft.fr.windev/95095-expressions-regulieres-regex-cherche-remplace/read.awp
s
Text
is string
= [
{\
tf1\ansi\ansicpg1252\deff0\
ouicompat\deflang1033{\onttbl{\0\nil\charset0 Tahoma;}}
{\colortbl ;\
ed0\green0\lue0;\
ed64\green85\lue141;\
ed0\green30\lue196;}
{\*\generator Riched20 10.0.17134}\viewkind4\uc1
\pard\cf1 Elem1\cf2 Hello \cf3 Elem2\par
2nd Liane : \cf3 Elem3\cf2\par
\cf3 Elem4\cf2 3rd\cf3 Elem5\cf2 Line : \cf3 Elem6\cf2\par
4th Line : \cf1 Elem7\cf0\par
}
]
s
Regex
is string
=
"(?<=\\cf[13] ).*?(?=\\cf.)"
cl
Matches
est un
MatchCollection
<
-
Regex.Matches
(
s
Text
,
s
Regex
)
POUR
TOUT
cl
Match
de
cl
Matches
Trace
(
cl
Match.value
)
//
POUR TOUT clGroup DE clMatch.groups
//
Trace(tab + clGroup.value)
//
FIN
FIN
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte