Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Separate the strings
Message
De
26/03/2016 14:12:16
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
26/03/2016 10:52:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01633712
Message ID:
01633810
Vues:
64
>Try this
>
function Lutz()
>
>	local s
>	text to s noshow flags 1 pretext 7
>		some text
>		>>>You guy
>		line 1
>		line 2
>		...
>		line nnn
>	endtext
>
>	local regexObj, pattern
>	regexObj = createobject('VBScript.RegExp')
>	regexObj.IgnoreCase = .f.
>	regexObj.Multiline = .f.
>	regexObj.Global = .f.
>	
>	pattern = '^(\x0d\x0a|.)*\x0d\x0a>>>You.*\x0d\x0a((\x0d\x0a|.)*)$'
>	regexObj.pattern = m.pattern 
>	
>	
>	local matches
>	matches = m.regexObj.Execute(m.s)
>	
>	do case
>	case !inlist(m.matches.Count, 1)
>		? 'fail'
>	otherwise
>		?matches.item[0].Submatches(1)
>		
>	endcase
>endfunc 
>
Okay. I try to understand this .....

So far I see a submatch containing all, until followed by the line I'm looking for (out of the hip: what happens if this is the first line?) + linebreak, followed by the rest as submatch

Why do I need the first submatch?
What does the | infront of the dot in the enumerations?
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform