I need a regular expression which roughly combines the logic of
?[1-9][0-9]+\s+X|x
with
X|x+\s*+[1-9][0-9]*
Or in english: match a pattern of the letter X (capitalised or uncapitalised) preceded by an integer (single space optional) OR succeeded by an integer (single space optional)
Thanks.
P.S. The two separate regex above are just for illustration; haven't actually tested them.
You're nearly there, you need enclosing brackets to group as a capture group and to handle numbers other than those 2 digits long.
Paste it into http://regexr.com/ to try it out. I tested it with: