Re:More on Hiring Software Developers
by marcosero on Thursday February 13, 2014 @08:26AM
(#7231179)
Parsing XML with a regex? I see why you have been immediately rejected
[ Parent
| on HN ]
Re:More on Hiring Software Developers
by vonmoltke on Thursday February 13, 2014 @08:46AM
(#7231284)
He specifically said "since it was all inside a single tag". Without knowing what the payload of the tag is, its hard to say if regex was appropriate or not.
Re:More on Hiring Software Developers
by kelseyfrancis on Thursday February 13, 2014 @10:52AM
(#7231965)
> its hard to say if regex was appropriate or not
I'd say it's never appropriate to parse XML with a regex. Even if you're just looking for something "inside a single tag", there are just too many gotchas like entities, CDATA sections, etc. Why bother with (or forget) any of that when there are well-tested XML libraries for probably every language, and many languages have it in their standard library.
Re:More on Hiring Software Developers
by vonmoltke on Thursday February 13, 2014 @12:11PM
(#7232533)
I think you and I are reading the statement differently. I did not read it as he was using regex to parse the XML; I read it as he as using regex to parse the text contents of a particular tag that he extracted using a standard XML parser.
Of course regex is appropriate in some cases. You parse XML with a standard API, then use a regex on the contents of a single tag. For all we know, inside the tag could have been "img: foobar", regex works great in that case.