in reply to Which one is the better Regex?
If we look at the first set, they are both wrong. Sure, in many cases, they will extract the title, but in some cases, they will not. For instance, in the first regex, you are assuming that any < starts a tag. This is not the case however. Furthermore, both regexes assume comments do not exist. Or CDATA marked sections. Note also that the latter one uses both (?i) and /i. One can be omitted.
As for the last set of regexes, both are so horribly wrong, that talking about which one is better carries no meaning at all. It's like asking "what's better to eat with fries? Yellow or wednesday?".
As the FAQ says, if you want to extract elements, or remove tags, PARSE the HTML, don't use trivial regexes.
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Which one is the better Regex?
by Rufnex (Novice) on Feb 27, 2003 at 14:11 UTC | |
by Abigail-II (Bishop) on Feb 27, 2003 at 14:30 UTC | |
by PodMaster (Abbot) on Feb 28, 2003 at 07:45 UTC |