Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any good tricks to help remember RegEx? [closed]

Tags:

regex

I don't always write Regular Expressions, but when I do, I feel like I'm learning it all over again. I'm looking for methods to retain the important parts, and put some method to the madness.

like image 467
dclowd9901 Avatar asked Jul 20 '12 18:07

dclowd9901


1 Answers

You should use the exact same trick that's used for remembering any API: use an accurate reference.

For example, when I need to work with Regular Expressions in JavaScript, I use the reference on MDN. If I need regex in PHP, I'll use the php.net reference. If I need regex in .NET, I'll use the MSDN reference.

It's better to not remember and look it up each time than it is to remember incorrectly and write it wrong.

like image 159
zzzzBov Avatar answered Sep 21 '22 21:09

zzzzBov