Q: Unquoting vars and arrays

Aug 23, 2010
675
9
This is what happens, when you use wrong tool for the job.
If you want to manipulate HTML, get HTML parser.
 
Dec 29, 2009
42
0
Atlanta, GA
@x13 - regular expressions ARE crazy, but they're an essential part of the foundations of computer science. They can also be considered an interesting alternative form of programming. I would highly recommend that you get a book on them, dig in, and really learn how and why they work, and how to use them.

Transparency Disclaimer: even though I followed my own advice (now many years ago), I nearly always need a guide or cheat sheet nearby when writing anything more complicated that "find.*this.*in.*that" !! Every tool seems to have its own variation on regex syntax!

(But once you've learned one of the more full-featured ones, they'll all start to seem familiar --- you won't have to re-learn EVERYTHING all over again each time.)
 
Dec 29, 2009
42
0
Atlanta, GA
PS: What I wrote doesn't refute @RogerB 's quote:

Some people, when confronted with a problem, think “I know, I'll use regular expressions.” Now they have two problems.

Like I said, regexs are crazy. Just because one knows how to use them doesn't mean one should use them! They're like a peculiar kind of screwdriver: they'll sit in your toolbox largely unused, and they shouldn't be used as a hammer, a prybar, or on most types of screws. But when you need them, you really need them!
 
Last edited:
Aug 23, 2010
675
9
It's really simple. And answer is in the name: RegExp's are to parse REGULAR text.
If a text have complex/irregular structure, or is not a text at all, like HTML or JSON, you are ought to use specific tools to deal with it.
 

Similar threads