I have a text
Word_1 (string_2)! String_3 - String_4 X_1:X_2
where String_2
, String_3
and String_4
can have one or multiple words (with numbers also, like aaa b32
), while X_1 and X_2 can be a single digit number or a [
(followed by a single digit number and a ]
, so something like 9:[4]
or [9]:4
).
And this regex (used inside an Android app) for matching String_4 (so the string between -
and X_1:
(?<=-s)[a-zA-Z0-9]+s([a-zA-Z0-9]+s)?
It works fine, but I've just realized that String_2 can also contains '- ' (for example String_2 = aaa - bbb ccc
) so I need to fix my regex for starting from last occurrence of -
(and again ending before X_1, considering that String_4 can have numbers as well).
How to do that?
I've tried (?:[^-](?!(-)))+$
but I can't find a way for avoiding the
after -
and to stop at X_1.
Thanks!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…