I’ve been trying to do this for quite some time but for some reason never got it right.
There will be texts like these:
- 12325 NHGKF
- 34523 KGJ
- 29302 MMKSEIE
- 49504EFDF
The rule is there will be EXACTLY 5 digit number (no more or less) after that a 1 SPACE (or no space at all) and some text after as shown above. I would like to have a MATCH using a regex pattern and extract THE NUMBER and SPACE and THE TEXT.
Is this possible? Thank you very much!
Since from your wording you seem to need to be able to get each component part of the input text on a successful match, then here’s one that’ll give you named groups
number,spaceandtextso you can get them easily if the regex matches:On the returned
Match, ifSuccess==truethen you can do: