

This Regular Expressions tutorial is divided into 3 sections. Anything highlighted in blue is text which the regular expression has matched. The blue text is the regular expression and the text below it is what we are testing it on. That's not very useful, or exciting, but as we delve further into regular expressions the examples will start to become more practical and powerful.įrom here onwards I will illustrate regular expressions as above. The bat took a bite out of the big boring apple. Will match every instance of the character b followed by either the character i or a So if we ran that regular expression over the following text it would match as follows: You may export data from one program as a text file then modify its layout so you may import it into another program using a text editor. You may wish to process certain files in a directory, but only if they meet particular conditions, in work you are doing on the command line. You may want to check that a password meets certain criteria such as, a mix of uppercase and lowercase, digits and punctuation etc in a program you are writing. You may wish to clean up some poorly formatted HTML by replacing all uppercase tags with lowercase equivalents in a text editor. You may wish to identify all email addresses in some content using a text editor. Search for particular items within a large body of text.That's kinda a bit abstract so let's try to put it into perspective. A regular expression is a means for describing a particular pattern of characters of text. The following pages are intended to give you a solid foundation in how to write regular expressions (Also referred to as regex or RE's).
