ID:40292
 
For some reason, RegEx is something that makes perfectly sane developers head for the hills. But unless you want to code 5000 lines of code for something that can be accomplished with one regular expression, I suggest you learn it. It will also allow you to actually understand what's going on in those cryptic .htaccess files :)

It's really not as hard as it looks. The problem is poor tutorials teaching you that RegEx operators are insanely difficult and that all you can do with a regular expression is validate forms. Okay, that isn't what they say, but I've only found a few half-decent tutorials out of hundreds.

RegEx goes much deeper than simply validating forms, and it's fairly easy to learn. The only rather difficult regular expression to understand is "(?>)", because you have to know how it works internally to understand why it's useful. Everything else, even the "advanced regex" is as simple as basic programming logic.

Part of my job is crawling websites and breaking through obfuscated javascript to access data feeds. In other words, I deal with horrifying, evil, invalid HTML and trash data that can't be parsed into XML or any sort of DOM. Regex has made this process insanely easy.

RegEx also makes it many times easier to secure your programs from XSS and database injection attacks.

So bite the bullet learn it. You'll be glad you did. Just a suggestion. :)

I would show you some crazy examples, but I left my list of random regex at work on paper :(
I used your post as the basis for a Dream Makers post (http://www.byond.com/members/ DreamMakers?command=view_post&post=40295). Hope that's OK!
Gughunter wrote:
I used your post as the basis for a Dream Makers post (http://www.byond.com/members/ DreamMakers?command=view_post&post=40295). Hope that's OK!

At least you were courteous enough to link back to where the post spawned from. =p
Audeuro wrote:
At least you were courteous enough to link back to where the post spawned from. =p

Right, now hopefully Kunark doesn't do what I do and clean up his blog posts regularly. :D

would you be willing to provide some links to resources that I could use to learn it? I've always wanted to learn reg ex
GoodDoggyTreat wrote:
would you be willing to provide some links to resources that I could use to learn it? I've always wanted to learn reg ex

Gughunter made a post to DreamMakers with a small list of helpful links (see: http://www.byond.com/members/ DreamMakers?command=view_post&post=40295). If all else fails, you can Google it. Once you get the hang of RegEx, it's pretty easy; the hardest part then becomes determining what exactly you need to parse for.
Hiead wrote:

Right, now hopefully Kunark doesn't do what I do and clean up his blog posts regularly. :D

HAHA I was just about to do that until I saw gughunter's link.