I am searching for a regex to match
- the text until (and including) the first occurrence of an underline and
- the text after the last occurrence of a hyphon, but cutting all leading zeros
Sample input:
Text_un_important-0011
Desired result (by concatenting all matches):
Text_11
I have come up with: (?:^|(?:00))(.+?)(?:$|_) but it has some flaws: It works only if there is exactly one hyphen at the end and two leading zeros. Unfortunately I cannot fix it.