in reply to Advanced regular expression help
The old wisdom applies: Parsing HTML with regexes is not good. If it's line based, try to parse it line based.
However if you insist on using regexes...
I don't quite get it - do you want the <ul id="ccc">(.*)</ul> part to be optional? If yes, make it optional: (?:<ul id="ccc">(.*)</ul>)?.
You have to take care that the .* doesn't consume too much text. What do you want the delimiter to be? Newlines? Then use \n or $ or ^ and use the /m modifier.
Also note that . won't match a newline unless the /s modifier is present (more on that in perlre):
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Advanced regular expression help
by Andrew Coolman (Hermit) on Sep 12, 2008 at 18:16 UTC |