@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.)
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!
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.