[thelist] Regex help

Dan Parry dan at virtuawebtech.co.uk
Mon Nov 26 13:19:21 CST 2007


Hi all

I'm writing a custom tagging system for use with a WCS (Website Control
System) so Da Boss(tm) can use a simple system and have W3C validated output

OK, that's the background, here's the problem... The tags appear in this
format:

[link page="index" text="Link" id="newLink"]

Now, that works fine and all attributes parse, but if I do this:

[link page="index" text="New link" id="newLink"]

It breaks because of the whitespace in the text attribute... Now, it seems
to me I have 2 options:

1) Replace whitespaces in attributes with a different character (not my
chosen solution)

2) Break the attributes apart (into an array with format 'key="Value"') and
deal with each attribute separately (preferred option)

For the life of me I'm not able to figure out the regex to do either (which
is odd because usually regexes are my 'Rainman' syndrome)

The proposed regex need only focus on the 'attributes' not the 'tag name'

Oh, the language is PCRE in PHP, by the way

Cheers in advance for any help

Dan

-- 
Signature in mail

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.16.7/1151 - Release Date: 25/11/2007
16:24
 




More information about the thelist mailing list