> This wouldn't match anchor tags with upper case,
>  but could be changed like so:
> </?[a|A][^>]*>

You've got two syntaxes mixed up there.

(?:a|A) or [aA] is what you want - no bar needed for square brackets.


> And I think it might be best to use a lazy match:
> 
> </?[a|A][^>]+>

That's not a lazy match - it's still greedy, just with a 1-char minimum match 
(which means it wont now remove "</a>").

To make it lazy, you would want *? or +? except you don't actually want to make 
it lazy here.

If anything, instead of greedy it should be possessive (using *+ or ++) but 
with the example here posessive wouldn't make much difference.
(It's main benefit is for when you've got "almost matches" which you want to 
exclude faster, as possessive prevents backtracking.)

And either way, you can't do possessive with the CF regex engine - you'd need 
to use the Java one:

        <cfset ad = form.addesc.replaceAll( '</?[aA][^>]*+>' , '' ) />

But since there's minimal benefit and that syntax would confuse some people, 
I'd probably just stick to:

        <cfset ad = rereplace(form.addesc , '</?[aA][^>]*>' , '', 'all' ) />


And I'd like to call specific attention to the lack of parentheses compared to 
the earlier suggestions, because they're completely unnecessary. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325562
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to