Ok, firstly a slight semantics rant:
Strong and Bold are NOT synonymous - just because the default styling for the 
Strong tag is bold does not mean that they are interchangeable.

Now that's out of the way, onto the regex side of things - your pattern will 
match this:
<b>[email protected]</strong>


When matching opening/closing tags, you need to ensure that they both match, 
like so:

<(tag1|tag2|tag3)>...</\1>

The \1 is a backreference to the first group in the expression - often people 
use these in replacements, but they work in the main expression too!


Another potential bug with the expression - what about this:
<b style="color:red;">[email protected]</b>

To match attributes, the simple way is to do:

<(tag1|tag2|tag3)[^>]+>...</\1>


For the actual email expression... well, true email regex is a nightmare, but a 
few obvious things:

 - [A-Z]{2,4} is not valid - what about .museum and others.
 - [email protected] and u...@localhost are both valid formats

If this is matching, rather than validating, best to just use a simple 
catch-all style, along the lines of:

[^@ ]+\.[^@ ]...@[^@ ]+?

(I'm not entirely happy with that, but too tired to come up with better.
Hopefully it gives the main idea - we don't need/want to be over-specific here.)


So, keeping in mind that B != STRONG, but putting all the above together, we 
get:

<(b|strong)[^>]+>[^@ ]+\.[^@ ]...@[^@ ]+?</\1>

which can be plugged into a refind/rematch as required. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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/cf-talk/message.cfm/messageid:318690
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to