> Anyone know how to do a regular expression that checks to see that a string
> starts with a value, but not return that value in the result.
Yes, using lookbehinds.
Similar to the lookahead you used, but works before text rather than
after it, and is notated like so: (?<=...)
Not sure about CF8, but CF7 didn't support these, so it's necessary to
use Java Regex instead.
Here's an expression that will do what you want:
(?s)(?<=<\!---\s{0,100}(\w{1,100}:\w{1,100})\s{0,100}--->).*?(?=<\!---\s*/\1\s*--->)
That {0,100} and {1,100} nonsense is because Java Regexes require a
maximum length for look-behind groups.
(obviously you can change the 100s to more suitable values if you know
what the actual maximums will be).
Another thing to note - I haven't done \< and \> like you did - both
because it's not necessary, but also in some regexes these means
"start of word" and "end of word" (a more targetted equivalent to \b),
so could potentially confuse someone looking at the regex without
knowing it's intended match.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive: http://www.houseoffusion.com/groups/regex/message.cfm/messageid:1205
Subscription: http://www.houseoffusion.com/groups/regex/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21