replacenocase(string, "[b]", "<b>", "all");
and
replacenocase(string, "[/b]", "</b>", "all");
Of course, that doesn't enforce pairing.
If you have CFMX, you can simply make the .* match nongreedy like this:
rereplaceNoCase(string, "\[B\](.*?)\[/B\]", "<B>\1</B>", "ALL");
HTH.
--Ben Doom
Phil Cruz wrote:
> I have an application where you can post comments but I don't want to allow
> html. I want to allow some formatting like in forums so I want to convert
> [B]this is bold[/B] to <b>this is bold</b>.
>
> I have a udf that does
>
> formattedString =
> rereplaceNoCase(arguments.stringToFormat, "\[B\](.*)\[/B\]", "<B>\1</B>"
> , "ALL");
>
> It works but if the string is [B]this is bold[/B] and [B]this is also
> bold[/B] it will convert the entire string as
>
> <B>this is bold[/B] and [B]this is also bold</B>
>
> rather than
>
> <B>this is bold</B> and <B>this is also bold</B>
>
> How can I fix this to get the desired result?
>
> Thanks,
> Phil
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
