I used this and it worked in all but one case (mentioned below).
ReReplaceNoCase(text, '\[quote who="([^"]*)"\](.*?)\[/quote\]', '\2', 'all')
\[quote who=" - escape the square bracket and match that text
([^"]*) - capture 0 or more characters that are not double quotes
"\] - match the double quote and escaped end square bracket
(.*?) - capture any character  --  this is the important part, the ? will
say to only capture as few as needed before the next text
\[/quote\] - match a bracked quote where the brackets are escaped.

Now this will give a result of:
Quote 1 Quote 2 [quote who="Tony4"]Quote 4[/quote]
Good, but not perfect. Another application of the tag or something else will
be needed. I'd have to see the desired output to be exact in this case.

> Hi guys, been a long time since I posted here.
> 
> I'm trying to write some bbml-style code.. Its working great for tags
> that don't have closing counterparts.. but for ones that do, I have a
> problem.
> 
> My text is:
> 
> [quote who="Tony1"]Quote 1[/quote]
> [quote who="Tony2"]Quote 2[/quote]
> [quote who="Tony3"][quote who="Tony4"]Quote 4[/quote][/quote]
> 
> My regex is:
> 
> (\[quote who="([^"]*)"\][/quote].*\[/quote\]*)
> 
> What I'd like it to do is replace each line with something.. The
> problem is that it finds the entire thing... all four quotes.. so the
> quoted text is:
> 
> ---Begin---
> Quote 1[/quote]
> [quote who="Tony2"]Quote 2[/quote]
> [quote who="Tony3"][quote who="Tony4"]Quote 4[/quote]
> ---End---
> 
> I would assume, of course, that the regex should find the first
> match..  Is there a way to do this? I've seen Depressed Press of
> Boston's code and its good.. but like the author has said, its huge...
> its slow for a tool, but its quick for what it is.
> 
> Thoughts?
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188825
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to