One of the most salient features of our Tech Hiring culture is that there is so much bullshit. Everyone knows this. Each of us contributes his share. But we tend to take the situation for granted.
The main problem with regex is that they overused.
For simple problems, regex are not needed, you have simpler, more readable solutions.
A combinaison of split(), subString(), removePrefix(), removeSuffix() is usually enough.
For complex problems, regex are not good at all.
Do not use a regex try to parse email, or URL, or HTML, ...
If the regex is not trivial, do not use a regex.
My advice:
Have a rule for pull requests that insists that every regex must come with a unit test that includes input that the regex is supposed to match and the ones that it's supposed to reject.
Have a rule for pull requests that insists that every regex must come with a unit test that includes input that the regex is supposed to match and the ones that it's supposed to reject.
For simple problems, regex are not needed, you have simpler, more readable solutions.
I used to feel the same.
Then I actually learned how to use regex.
Now I think that non-regex solutions that use more than one function are better done with regex. Because 80% of the time you only need simple regex patterns.
For complex problems, regex are not good at all.
(Almost) totally agree.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The main problem with regex is that they overused.
For simple problems, regex are not needed, you have simpler, more readable solutions.
A combinaison of
split()
,subString()
,removePrefix()
,removeSuffix()
is usually enough.For complex problems, regex are not good at all.
Do not use a regex try to parse email, or URL, or HTML, ...
If the regex is not trivial, do not use a regex.
My advice:
Have a rule for pull requests that insists that every regex must come with a unit test that includes input that the regex is supposed to match and the ones that it's supposed to reject.
I agree about the part where people shove in regex where it's absolutely overkill.
Will do <3
I used to feel the same.
Then I actually learned how to use regex.
Now I think that non-regex solutions that use more than one function are better done with regex. Because 80% of the time you only need simple regex patterns.
(Almost) totally agree.