Reputation: 92
Actually, I work in a language support for Atom (by git) and I use js regex but I must learn more about that. I need to capture on groups:
/exe c:\dos\main.cpc /l:check
I need a group with exe/
, another with c:\dos\main.cpc
, another with /l:
and the last with check
.
I already tried that:
(exe/)([^=]+)(/l:)(.*)
but it did not work.
Can you help me?
Upvotes: 1
Views: 632
Reputation: 350137
You could use this one:
(.*?)\s+(.*?)\s+(.*?:)(.*)
Here is a regex test example of that.
The logic is as follows:
Upvotes: 0
Reputation: 11275
You forgot to escape delimiter /
Your regex should be:
(exe\/)([^=]+)(\/l:)(.*)
I suggest you test your regex on this website: https://regex101.com/
It will check the syntax for you with the explanation of every elements you use in your regex ;)
Upvotes: 3