source1Tamer
Posts: 91 Joined: Tue Nov 13, 2001 3:49 pm
Post
by source1Tamer » Fri Mar 08, 2002 4:03 pm
I want to rex the following string out of a paragraph:
[ss33] [Mess. Privato] [Home Page] [Cerca Mess.] [Aggiungi Amico] [Modifica Mess.] [Quota e Rispondi]
I coudn't get it all working, I got only the first part "[ss333]" but I coudn't get the rest of the string by using:
<rex ">>=\[=\alnum*\]+" $stringValue>
how could I repeat the whole rex for the rest of the string or is there any other way to do it.....
John
Site Admin
Posts: 2622 Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:
Post
by John » Fri Mar 08, 2002 4:10 pm
$ret should have contained all occurrences in separate elements, so
<loop $ret>
$ret
</loop>
would have shown them. To concatenate them again you
could use <sum %s '' $ret>
John Turnbull
Thunderstone Software
mark
Site Admin
Posts: 5519 Joined: Tue Apr 25, 2000 6:56 pm
Post
by mark » Fri Mar 08, 2002 4:11 pm
All the other items also have space in them and some have "." not just alnum. Use a set with all the required characters. And your ">>=" should be just ">>".
source1Tamer
Posts: 91 Joined: Tue Nov 13, 2001 3:49 pm
Post
by source1Tamer » Fri Mar 08, 2002 4:54 pm
I got it working by using
">>=\n*\space*\[=\print+\n+"
as I would like it to match only the first line of the paragraph.
thx.
mark
Site Admin
Posts: 5519 Joined: Tue Apr 25, 2000 6:56 pm
Post
by mark » Fri Mar 08, 2002 5:43 pm
Oh, an entirely different set of requirements...
\n*\space* can be simplified to \space* since \n is included in \space.
Depending on requirements I might change \print to [^\n] in case there happens to be some non-printables and I wanted the whole line.
>>=\space*\[=[^\n]+\n+