Regular expressions

Regular expressions are very useful and geeky. I am not an expert with regexp. Here I’m slowly going to collect a list of regular expressions, tools and examples that I use myself from time to time. I’m hoping to learn more in the process.

regexp does example does
^foo match beginning ls -la|grep ^d a list of directories
foo$ match end find .|grep \.gif$ list al files ending in .gif

3 thoughts on “Regular expressions

  1. how about this for the second example:

    ls -la | grep “\.gif$” # list of all objects ending with “.gif”

  2. Regexps are powerful. Lots of good example on the PHP manuals. preg_match() and preg_match_all and preg_replace() is fast and useful

Comments are closed.