I'm sorry, but I am not sure how to correctly describe my problem. I have to match multiple lists of none-sequential 3-digit numbers, which must be prefixed by a string that includes another three digit number, and must end with a hash. Looking like this:
\*123\*(<list of 3 digit numbers>)#
This match can also have be optionally suffixed with another match of 3-5 digit numbers, looking like this:
\*123\*(<list of 3 digit numbers>)\*(<3-5 digit numbers>)#
I'm currently struggling on how to combine these two regexes without having to repeat the main list of none-sequential numbers (trying to avoid having to write this:
\*123\*((<list of 3 digits numbers>)|(<list of 3 digit numbers)\*\d{3-5}))#
)
, so the entire regex is a bit more readable, and easy to modify.
The (<list of 3 digit numbers>)
I'm trying to avoid having to write twice is very hard to read:
((10[1-9]|110)|2[0-9][09]|(30[1-9]|110)|(40[3-9])|41[01])|(41[2-6])|(42[12])|(43[0-9])|(44[1,5-9])|((?!456)45[0-9])|(46[1-7])|(47[2,5-9]|48[0-9]|49[4-9])||(51[2,3,6,8,9])|((?!526)52[0-9])|(53[0,2,5,7,9])|(54[0-1,3-9])|(55[0-4,6,9])|(56[0-6,8])|(57[0-2])
Please is what I intend, possible?
Thanks in advance!