Is it a must for every programmer to learn regular expressions?
21–30 of 60 posts
Re: Is it a must for every programmer to learn regular expressions?
#22Yes, it is, without a doubt. It's one of the most universal tricks of the trade that you'll literally never regret learning, mainly because just about any environment you'll ever work in will by necessity support regexes, and in many, it will be the primary way you interact with text. But it's also a must that you realize that despite the fact that they're exceptionally useful and widely supported, regexes are a disg…
How would you design a regular expression syntax more intuitively? Personally, I find beauty and simplicity in regular expressions. Sure, they can grow to hideous atrocities, but you can achieve such disastrous feats with any language/syntax. Maybe you could back up your claim of regexes being a disgusting abomination with, at the very least, anecdotal evidence.
\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b
Which is also what happens when a cat walks across the keyboard.Re: Is it a must for every programmer to learn regular expressions?
#23Earlier quoted context omitted.
How would you design a regular expression syntax more intuitively? Personally, I find beauty and simplicity in regular expressions. Sure, they can grow to hideous atrocities, but you can achieve such disastrous feats with any language/syntax. Maybe you could back up your claim of regexes being a disgusting abomination with, at the very least, anecdotal evidence.
A typical regex looks like this: \b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b Which is also what happens when a cat walks across the keyboard.
Re: Is it a must for every programmer to learn regular expressions?
#24Yes, it is, without a doubt. It's one of the most universal tricks of the trade that you'll literally never regret learning, mainly because just about any environment you'll ever work in will by necessity support regexes, and in many, it will be the primary way you interact with text. But it's also a must that you realize that despite the fact that they're exceptionally useful and widely supported, regexes are a disg…
How would you design a regular expression syntax more intuitively? Personally, I find beauty and simplicity in regular expressions. Sure, they can grow to hideous atrocities, but you can achieve such disastrous feats with any language/syntax. Maybe you could back up your claim of regexes being a disgusting abomination with, at the very least, anecdotal evidence.
The greatest syntactical atrocity in regexes is that they don't have the `x` modifier (in Perl parlance) on by default. This means that you can't use whitespace to chunk code into meaningful bits, nor can you comment it to easily document what does what or explain a particularly hairy section to handle some weird edge case. This means that regexes degenerate a lot faster than ordinary code in terms of readability.
Edit: Misplaced close paren.
Re: Is it a must for every programmer to learn regular expressions?
#25Re: Is it a must for every programmer to learn regular expressions?
#26Re: Is it a must for every programmer to learn regular expressions?
#27Re: Is it a must for every programmer to learn regular expressions?
#28Re: Is it a must for every programmer to learn regular expressions?
#29I was thinking about this question and it occurred to me. The programmers who probably don't need to know regexes[1] almost certainly already learned them. So I guess that's a yes. [1] Thinking of embedded systems developers creating code for, say, automotive entertainment systems, or control code for scientific or medical hardware.
[1] Thinking of embedded systems developers creating code for, say, automotive entertainment systems, or control code for scientific or medical hardware. Don't they have log files to read?
But the point is I can't imagine someone getting to that point without previously having learned it.
Re: Is it a must for every programmer to learn regular expressions?
#30Earlier quoted context omitted.
How would you design a regular expression syntax more intuitively? Personally, I find beauty and simplicity in regular expressions. Sure, they can grow to hideous atrocities, but you can achieve such disastrous feats with any language/syntax. Maybe you could back up your claim of regexes being a disgusting abomination with, at the very least, anecdotal evidence.
IMO, the main problem is that the syntax is too terse. The syntax is taken wholesale from the algebraic notation used in mathematics and dropped in unmodified. Essentially, regex code ('cause regexes really are code) is not skimmable. The greatest syntactical atrocity in regexes is that they don't have the `x` modifier (in Perl parlance) on by default. This means that you can't use whitespace to chunk code into meani…
I always wonder what regexes would look like if they were derived from Python instead.