I want to match a specific pattern that is always preceded by a symbol but, it can be repeated many times after the symbol (but not the symbol itself)
for example:
# 336t, 558z, 533 Nkqe <--- the end of the string is unpredictable but I have some "terminators".
# 1512a, 22b, 23 NeKok 22, 24 <--- (22, 24 shouldnt match)
this regex gets me close to it:
\s?\d+[a-z]?,?(?R)?
But I want to make sure it only works if we have # or ## at the beginning of it. I cant use the anchor ^ because it might be in the middle of other text. But as soon as I try either look arounds or the # anywhere the recursion breaks.
How can I make it so that only a part of the regex is used in the recursion?
I have tried:
#\s?\d+[a-z]?,?(?R)?
(?<=#)(\s?\d+[a-z]?,?(?R)?)
(?<=#)?(\s?\d+[a-z]?,?(?R)?)
None of them give me the correct result:
after matching the `#`, find digits with an optional letter,
separated by commas until I find a terminator keyword or a word boundary