>>>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?
>
>
>> what happens if this is the first line?)
>It won't work - use pattern below
>
>pattern = '^(.*\x0d\x0a)*>>>You.*\x0d\x0a((\x0d\x0a|.)*)$'
>
>
>> Why do I need the first submatch?
>In fact you need the second submatch - they are zero based
That's what I understand. My question was more like
pattern = '\r\n>>>You.*\x0d\x0a((\x0d\x0a|.)*)$'
hm looks like at least
pattern = '(^|\r\n)+>>> You.*\x0d\x0a((\r\n|.)*)$'
but then I have a first submatch too.
:)
I do not realy understand why I should need to include anything
'^(\x0d\x0a|.)* infront of >>> You. It should be enough to have the beginn or the linebreak? Multiple Linebreaks are a problem of its own, but I think the (^|\r\n)+ should solve this?
>>What does the
| infront of the dot in the enumerations?
>
>That is the OR symbol
My failure. I was into []
>Alternatively, there's nothing holding you back finding the '>>> You' with or without regex, then taking the rest after the match
For now I search for the
^>>> You.*$ with global = .f. and substring from the next line. But it feels so akward... So the use of submatches was something new this week.
Thank you.
I have no VFP at hand (just a browser) right now.
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.
OffThere is no place like [::1]