'regex to find a 44 length string after " - "

I have the following regex that will find a string length of 44 digits / letters:

^[A-Za-z0-9]{44,}$

the problem is that my text file is built like that:

XXXXX - SOMETHINGSOMETHINGSOMETHING55252
XXXXX - SOMETHINGSOMETHING985295829

So, I want the search to start after the "space - space" I tried to do it by my self with out success :( Thanks in advance



Solution 1:[1]

Use

(?<=- )[A-Za-z0-9]+$

See regex proof.

EXPLANATION

- Positive Lookbehind (?<=- ) assert that the Regex below matches the characters "- " literally (case sensitive) on the left
- [A-Za-z0-9]+ - Match a single character present in the [A-Za-z0-9] list between one and unlimited times, as many times as possible, giving back as needed (greedy)
- $ - asserts position at the end of a line

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ryszard Czech