bbcode parsing

R

Rob Meade

Hi all,

Back on the bbcode parsing (again)...

Having a few problems now with nested tags - it would seem that I had
written my test string in a way that worked perfectly with the parser -
until I changed the order of the parser - then it stopped working...

I'm assuming my problem is down to things like this:

' define BOLD tags text
strPattern = "\[b\]([^\]]+)\[\/b\]"

in my pattern I have

([^\]]+)

which I believe means "match any of the characters not enclosed", as a
result when I have:

Google

I get a nice hyperlink, but with and at either end (not converted
to <b> and </b> etc)...

If I take out the above then it just wont work at all as it'll start ending
tags all over the place, does anyone have any ideas on how I can achieve
what I want to achieve? I've next to nothing online regarding ASP and
bbCode, seems mainly php...

Any info appreciated,

Regards

Rob
 
R

Roland Hall

in message
: Back on the bbcode parsing (again)...
:
: Having a few problems now with nested tags - it would seem that I had
: written my test string in a way that worked perfectly with the parser -
: until I changed the order of the parser - then it stopped working...
:
: I'm assuming my problem is down to things like this:
:
: ' define BOLD tags text
: strPattern = "\[b\]([^\]]+)\[\/b\]"
:
: in my pattern I have
:
: ([^\]]+)
:
: which I believe means "match any of the characters not enclosed", as a
: result when I have:
:
: Google
:
: I get a nice hyperlink, but with and at either end (not converted
: to <b> and </b> etc)...
:
: If I take out the above then it just wont work at all as it'll start
ending
: tags all over the place, does anyone have any ideas on how I can achieve
: what I want to achieve? I've next to nothing online regarding ASP and
: bbCode, seems mainly php...

How about this:
\[b\](.+)\[\/b\]

For bold, colors, etc, you could just use this:

if instr(1, str, "") then
str = replace(str, "","<span style=""font-weight: bold"">")
end if
if instr(1, str, "
") then
str = replace(str, "
","</span>")
end if

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top