4 ms·
Am I the only one that is has been coding for years and don't expect people to know regex off the top of their head? There are so many variants and keeping the
by jtchang 10y ago
Am I the only one that is has been coding for years and don't expect people to know regex off the top of their head?
There are so many variants and keeping them straight between languages is a nightmare. Grep, egrep, POSIX, perl, python, php, javascript. They all have their idiosyncracies.
- dimino 10y agoI feel that regex is kind of like SQL -- it's universal enough that knowing the major tropes is important for general software development.
- hvidgaard 10y agoProblem is that every framework have their own dialect of it, and many of them are not even regular expression, but something beyond that.
- thedufer 10y agoThe most common dialect is PCRE. Most languages have an implementation of either that or a superset of it.
- hvidgaard 10y agoThe most common dialect is PCRE. Most languages have an implementation of either that or a superset of it. PCRE isn't exactly simple to begin with. That languages may implement it, or a superset of it, is exactly the problem. I know regular expressions very well, or rather I know regular languages and can fairly easily identify if a problem is solvable as a regular expressions. But once you start to go beyond that, it's not simple anymore and the benefit of a regular expression is lost.
- thedufer 10y agoIf you know what . does, various repetition markers (*,+,?,{}), and character classes, you're 90% there. Back-references are another big portion, although that's admittedly where things start getting a bit complex.
- rahulr 10y agoTrue. And perhaps more importantly, for many cases regex is a very small part of job, if at all. I would rather test someone how they would refactor a method or a class. Something which is much more likely to happen in a real world situation (as compared to regex).