Is it worth mastering? No. Worth understanding? Yes. Regex is used in so many applications and commands, it would be silly not to learn it. You don't need to be a wizard, but do understand the basics and it will get you far.
How "junior" developers can become regex wizards
31–40 of 46 posts
Re: How "junior" developers can become regex wizards
#32Bonus: it makes them easier to diff, too!
We don't write our code on one line with no comments, writing regexps should be no different.
[0] Python example: http://docs.python.org/2/library/re.html#re.VERBOSE
Re: How "junior" developers can become regex wizards
#33Go read Mastering Regular Expressions.
Re: How "junior" developers can become regex wizards
#34This might be overkill but I found I never "got" regular expressions until a class made me think about them as state machines. The additional bashing over the head of having to implement a parser/matcher made it really stick. The quirks and syntax make much more sense when you know why and how a regex engine works. That said, anything involving extended/perl regex I wind up googling.
Re: How "junior" developers can become regex wizards
#35Is it worth mastering? No. Worth understanding? Yes. Regex is used in so many applications and commands, it would be silly not to learn it. You don't need to be a wizard, but do understand the basics and it will get you far.
Re: How "junior" developers can become regex wizards
#36--edit
I am not a developer.
Re: How "junior" developers can become regex wizards
#37A couple things: 1. Be careful what you use regex's for. Email addresses are very difficult[0]. HTML is impossible[1]. 2. There are a number of tools that make it easier to understand, including [2]. [0] http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html [1] http://stackoverflow.com/a/1732454/2363 [2] http://ivanzuzak.info/noam/webapps/fsm_simulator/
> HTML is impossible. This comes up a lot. Most languages' "regular expressions" aren't, in fact, regular. A true regular expression wouldn't be able to match HTML, but Perl regular expressions (the de facto standard) can because of backreferences. Edit: I'm not saying this is a good idea; it most certainly isn't. I'm just saying its possible.
That being said, there surely are some fun languages that can be matched by what's commonly called regular expressions. Notepad++ was notable (before switching to PCRE) that its "regular expressions" could not even match every regular (or even finite) language (http://stackoverflow.com/a/4815422/73070). Many regex engines allow matching languages that are context-sensitive, while at the same time not accepting all context-free languages.
Re: How "junior" developers can become regex wizards
#38Re: How "junior" developers can become regex wizards
#39This might be overkill but I found I never "got" regular expressions until a class made me think about them as state machines. The additional bashing over the head of having to implement a parser/matcher made it really stick. The quirks and syntax make much more sense when you know why and how a regex engine works. That said, anything involving extended/perl regex I wind up googling.
Huh, to me I "got" regexp the first time I used it (although it took a while to learn the details). To me if you understand the idea of wildcards, you understand regexp.