Link Details

Link 31301 thumbnail
User 71517 avatar

By Volume4
via immike.net
Published: Jul 20 2007 / 09:02

I’m going to assume you have a basic understanding of regular expressions at this point. If you’re a regex n00b (or /n0{2}b/, as I like to call them), or if you need a quick refresher, check out my previous post on the absolute bare minimum that every programmer should know about regular expressions. You won’t be disappointed. So, without further adu, here are the five regular expressions that I have found the most useful for day-to-day web programming tasks.
  • 20
  • 3
  • 3407
  • 1808

Comments

Add your comment
User 184684 avatar

kdavies replied ago:

0 votes Vote down Vote up Reply

This was a nice article, unfortunately it gave some bad information. For example, it suggested /^[a-zA-Z0-9_]{3,16}$/ to match a user name. That is way too complex when you can just use /^\w{3,16}$/ to match the exact same thing. Also the suggestion to use regular expressions for xml should be heavily qualified to point out there are a lot of times regular expressions just won't work for parsing xml. For example, he suggests {]*>(.*?)} to find the contents of a tag. This will work fine if you never have the same tag embedded within itself, but if you are doing webscraping like he suggests, you will often have things like " <div>This is a div <div>This is an embedded div</div><div>This is another embeded div</div></div>". In this case his regular expressions will match " This is a div This is an embedded div" and not what was intended.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.