I'm trying to find a way to "say something" in REGEX but it's not working. PLEASE HELP ME OUT.
If I had the following string:
<select name=1>
<option value=a >label a
<option value=b >label b
</select>
<select name=2>
<option value=c >label c
<option value=d >label d
<option value=e >label e
</select>
You've got two select elements. If I do a regex search using this pattern:
(<select)[>]>{1}.(</select>)
I'm not going to get two instances, I'm going to get one containing both, because the regex engine in "greedy" for the largest possible string.
Well, I know in the brackets you can use ^ to exclude certain characters, but how can you exclude certain exact combinations?
In other words, in English I would say:
"Find a <select tag, then stuff in the tag, then a closing >, and then ANYTHING EXCEPT ANOTHER SELECT TAG, and then a closing </select> tag."
I can do everything except for that "ANYTHING EXCEPT ANOTHER SELECT TAG" phrase. Is there any way to do this? I'm just trying to pull out data in the fewest possible steps.
Sam Fullman,
Compass Point Media