string = "id <xx> MM blah blah"
'MM' is a optional value in string ...
If 'MM' exist, I want to capture contents seperately both before and after 'MM'. If 'MM' doesn't exist, just capture the entire string.
examples:
If 'MM' exist ...
/(.*)M{2}(.*)/
$1 = 'id <xx> '
$2 = ' blah blah'
This is ok...but obviously I have to account if 'MM' is not in string.
I've tried ...
/(.*)M{0,2}(.*)/
/(.*(?=MM))M{0,2}(.*)/
Can someone enlighten me and stop my head banging ...?
Thanks ...
/
'MM' is a optional value in string ...
If 'MM' exist, I want to capture contents seperately both before and after 'MM'. If 'MM' doesn't exist, just capture the entire string.
examples:
If 'MM' exist ...
/(.*)M{2}(.*)/
$1 = 'id <xx> '
$2 = ' blah blah'
This is ok...but obviously I have to account if 'MM' is not in string.
I've tried ...
/(.*)M{0,2}(.*)/
/(.*(?=MM))M{0,2}(.*)/
Can someone enlighten me and stop my head banging ...?
Thanks ...
/