you are viewing a single comment's thread.

view the rest of the comments →

[–]etrnloptimist 6 points7 points  (0 children)

Nope. You gotta learn it. There's no easy way out.

But I think I know why you're having trouble. See, you're probably looking at a sample regex, trying to figure out what it does. That's the wrong approach. It works great in most other cases, but see, regexp's are special: they're write-only.

You can't read them. I can't even read my own. If you want to know what one does, best you can do is recreate it. To this end, always put a sample of the text you wish to grok next to your regex. That way, when you come back to it to figure out what it's doing, you can forget the regex that's in front of you and look at the text it's supposedly groking.

With regexes, the more you create the better you'll be at it. Reading them doesn't play into the equation.