[H-GEN] regex brian fade

Benjamin Fowler ben.fowler.bjf at gmail.com
Fri Jun 5 05:08:59 EDT 2015


Hold it right there!

On 5 June 2015 at 05:59, mick <bareman at tpg.com.au> wrote:

> On Fri, 05 Jun 2015 14:43:20 +1000
> Paul Gear <humbug at libertysys.com.au> wrote:
>
> >  "[a-zA-Z0-9:]*"
>
> many thanks to Paul & Russell
>
> just what I needed
>


You're trying to parse XML with regexes. Not recommended, because you can
have any combination of unmatchable whitespace in an XML document, and
still have the 'same' XML document. If you're not careful, your regexes
will break without warning.

I would do this for a quick hack (say, to whip up some test data), but I
sure wouldn't put this into production.

Depending on what you're doing, I'd look at something like XQuery, an XSLT
stylesheet (selecting all the interesting nodes, and then outputting them
as text) (use xsltproc(1)), or a one-shot Python script.

Cheers, Ben.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.humbug.org.au/pipermail/general/attachments/20150605/0be3859b/attachment.html>


More information about the General mailing list