| containsregex and concat | containsregex and concat 2006-11-27 - By Rebhan, Gilbert
Hi,
<table[^>/]*>(.*?)</table>
should match :
<table class="summary">foobar</table>
also with more than one attribute
<table class="summary" foo="bar">foobar</table>
foobar is /1 (group 1)
Regards, Gilbert
-----Original Message----- From: George Bills [mailto:gbills@(protected)] Sent: Monday, November 27, 2006 6:41 AM To: Ant Users List Subject: Re: containsregex and concat
Hrm, it probably isn't since advanced regexs are still black magic to me. The "." was supposed to match any character, including a newline (with the s flag), the * to say match 0-n of them and the ? to say be lazy, match as little as possible (so that I don't pull in <table>...</table><table>...</table> in one match).
I just tried [^<], but it doesn't seem to work - I think because of such
things as "<table><tr>...</tr></table>" - the opening bracket of <tr> conflicts. I tried [.<>]*? to make sure that the "regex.body" part was matching the brackets, but that didn't work either.
Also, <table class="summary"> was wrong - <table class="summary"(.*?)> is a little better since the tables can have more than the class attribute (in fact, all of them do). But after changing that I'm matching the entire document - <html> through to </html>. That might just be because I'm using filetokenizer - if I make one match within filetokenizer, do I end up getting the entire document? If so, how do I get only the matching text?
Regex is now: <table class="summary".*?>.*?</table>
Thanks for the help, I appreciate it.
--------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@(protected) For additional commands, e-mail: user-help@(protected)
|
|
 |