5
I have the following text::
From: .... blabla bla
Message: blablabalab
//linha em branco
From: .... blabla bla
Message: blablabalab
//linha em Branco
From: .... blabla bla
Message: blablabalab
How do I get my regex to pick up where the From
and for before starting the next From
?
So far I have the following regex: From\s\-\s\w{3}\s\w{3}([^\n]*\n+)+
. What I want is for every part of the text that contains From
until you start another From
stay in a group. Only my regex tah picking everything up by the end of the text.
Does anyone know how I can do it?
And it needs to be
RegEx
?– Maniero
What’s another way? @bigown
– MeuChapeu
I just didn’t respond in any other way because you say you want to
RegEx
and because I didn’t fully understand the pattern. Maybe I could use a simpleSplit
. Maybe he won’t solve it and would need to make a bond by figuring out the breaking point withIndexOf
and take what matters withSubstring
. I think more purposeful, although I understand that other people see themselves better withRegEx
. Of course without a clear pattern, any solution is difficult.– Maniero
Well, after your question whether you need to use regex,
Regex.Split
. Then I modified the regex to take only the part ofFrom
. I use regex because noFrom
contains dates and they always change. So I have exactly what I wanted. Thank you.– MeuChapeu
Nice to have settled, but I think the
string.Split()
would already solve. Put the answer.– Maniero