I want to split a string like this:
abc//def//ghi
into a part before and after the first occurrence of //
:
a: abc
b: //def//ghi
I'm currently using this regex:
(?<a>.*?)(?<b>//.*)
Which works fine so far.
However, sometimes the //
is missing in the source string and obviously the regex fails to match. How is it possible to make the second group optional?
An input like abc
should be matched to:
a: abc
b: (empty)
I tried (?<a>.*?)(?<b>//.*)?
but that left me with lots of NULL results in Expresso so I guess it's the wrong idea.