• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Parsing XML/Formatted TXT into a HTML document.

I'll report you to the moderator. This is green cow abuse. :mad:
FYI we green ones are very tight *ssed.
 
Originally posted by Cheap Bastard
just wondering...
what exactly does (.*?) mean?

. = any character (except new line unless you tell it to include them using /s option)

* = zero or more

? = match as little as possible

() = remember this bit for later + plus helps group things

so


/x(.*?)x/ on string "x123x456x"

(.*?) matches 123 as the first match
(.*) would match 123x456

takes sometime to get your head round then it's easy but can take time to translate them
 
Hmm... there are perl modules to do this kind of thing. Off the top of my head I think XML::parser does the stuff you're asking for.

-mk
 
I'm pretty sure '?' means the part directly before it is optional.

So 'colou?r' would match both spellings: color and colour

-mk
 
Originally posted by atlas
I'm pretty sure '?' means the part directly before it is optional.

So 'colou?r' would match both spellings: color and colour

-mk

? is ungreedy matching


you want something like /colou{0,1}r/
 
Back
Top