I'm a beginner at regex and still don't understand a lot. I apologize in advance from any wrong notations or missing information :(
I need to extract groups from an e-mail subject where I have to use each value further on in a process to use as a folder or document name.
Example: 123456/TEXT/567890/01Moretext
I need to get the following pieces of text:
123456
TEXT
567890
01Moretext
in seperate regex commands.
So far I have:
^\d{6}
, which gives me 123456
(?<=/)[^/]*
, which gives me TEXT
567890
[^/]*$
, which gives me 01Moretext
Would appreciate any help that can prevent my head from exploding!
You can use
[^/]+(?=/[^/]*$)
See the regex demo. Details:
[^/]+
- one or more chars other than /
(?=/[^/]*$)
- a positive lookahead that requires a /
and then one or more chars other than /
till the end of string.