[REBOL] Re: A question about a regular expression
From: SunandaDH:aol at: 17-Oct-2004 5:22
[lethalman--fyrebird--net]:
> Is there any way to do this?
There are lots of ways to do it. The best will depend on what other
conditions need to be met (ie what else could be in the string being parsed)
This works for the original example:
x: "<a href='http://bla'>Test</a><a href='http://blabla'>Test2</a>"
foreach item load/markup x [if string? item [print item]]
Test
Test2
Unlike the Perl, this will work if the anchor tag is more complex, eg:
<a class="aaa" href="/index" style="color:blue">Test</a>
But it will also find *all* strings in the input, not just those between
anchor tags, not just anchor tags. That may not be what you want:
x: "<div> <a href='http://bla'><strong>Test</strong</a><a
href='http://blabla'>Test2</a></div>"
foreach item load/markup x [if string? item [print item]]
Test
Test2
Sunanda