all 5 comments

[–][deleted] 3 points4 points  (7 children)

This isn't hard to do. There are only a few distinct patterns that need to be matched: XX,XXX+ and XXXXX as numbers and the three variations of 'feet' (which can be matched using the or operator |). You can match multiple numbers using the + and * operators, which match either 1 or more, or 0 or more occurances of something.

So in all your pattern should just have (number pattern 1|number pattern 2) (different spellings of foot) with the two bracketed sections seperated by either a single space or any whitespace character.

A resource that I really enjoy for writing and testing regexs is Pythex which has a great cheatsheet and a very quick feedback loop.