4 ms·
If you're using PCRE you should also make use of named patterns. It makes the expression easier to understand as you can reuse parts of it (a little like functi
by arkh 9y ago
If you're using PCRE you should also make use of named patterns. It makes the expression easier to understand as you can reuse parts of it (a little like functions) and the matched patterns can be then used in your language with their name instead of their position. Decoupling the usage from the regexp so it is more robust.
http://www.rexegg.com/regex-capture.html#namedgroups http://www.rexegg.com/regex-capture.html#namedgroups
- reificator 9y agoThat would be nice to have when working in Javascript, making code a lot more readable and easy to update. Alas, we don't get such luxuries as named groups or static typing... Woe is me.