Bag Of Cows

Regular Expression Playground


Some examples to play with

Ah, ba ba ba ba Barbara Ann
Ba ba ba ba Barbara Ann

Oh Barbara Ann, take my hand
Barbara Ann
You got me rockin' and a-rollin'
Rockin' and a-reelin'
Barbara Ann ba ba
Ba Barbara Ann
Try making a regular expresion to find:
  1. the letters 'ba' regardless of whether they are upper or lower case
  2. the letters 'ba', but only when they are a word on their own, not part of Barbara
  3. any word with an apostrophe after it
  4. 'Ann' and also 'and'

Marie has set up home
With a man who's half my age
A halfwit in a leoatard stands on my stage
The standards have fallen 
My value has dropped
But dont shed a tear
Some walk like they own the place
Whilst others creep in fear
Try if you can to walk like a man
But you dont come near

You've got to fly like an eagle
Prowl like a lion in Africa
Leap like a salmon home form the sea
To keep up with me 
You've got to walk like a panther tonight
Walk like a panther tonight
Try making a regular expresion to find:
  1. All the works which start with a capital letter
  2. everything you are supposed to be like
  3. anything that rhymes with 'near'

Try making a regular expresion to find:
  1. All the post codes
  2. All the phone numbers (note that they are not all in the same format)
  3. People with a email address
  4. Three of the emails have been typed in wrongly. Write a regular exression for a valid email to detect whose are wrong.


It is very easy to get overwhelmed with the complexity of regular expressions. For the purposes the A Level course, you only need to know the basics.

This sheet here contains more than enough. You don't need 'Backreferences' or Advanced, but everything else could come up. Questions often involve using the 'OR' feature.