Incase you haven’t realized.... regex's aren’t my forte!

This seems to be the last little kink to get out of this thing and it will
be set (or I'm going back to the original Jim Davis loop!)

str = rereplace(str, "(\[hr\])(?!(?!\[code\]).*?\[/code\])", "<hr>", "ALL");

this regex works perfectly as long as the string doesn't contain
[code][\code] blocks and doesn't have any single tags BEFORE the code (like
[hr])

if there are code blocks then the above regex will only replace [hr] with
<hr> AFTER the [code][/code] tags and leave any [hr]'s that come before it
unchanged

it doesn't replace the [hr]'s that fall inside the [code][/code] blocks
either but that's what it's supposed to do, so apparently what it equates to
is...

replace [hr] if its after the last [/code] tag found

and it should be...

replace [hr] unless its after any [code] tag AND before the NEXT [/code] tag


this block ...

[hr]
[code][b]some code[/b][/code]
[hr]
[code][b]some code[/b][/code]
[hr]

Is transformed into...

[hr]
<pre>[b]some code[/b]</pre>
[hr]
<pre>[b]some code[/b]</pre>
<hr>

The first 2 [hr] tags should be <hr> everything else works fine.


just when I thought that I was actually getting better at regular
expressions... sigh


That is just the regex for tags without closing tags. The other regex for
tags that have open and close works great like [b][/b]

str = rereplace(str,
"(\[b\]([Aa-zZ0-9\s]*)\[/b\])(?!((?!\[code\]).)*?\[/code\])", "<b>\2</b>",
"ALL");




cf-talk... Pimp my regex! Sorry... couldn’t resist :)

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005
 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get help! RoboHelp
http://www.houseoffusion.com/banners/view.cfm?bannerid=58

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190653
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to