Consider the following lines:
1: cccbbb
2: cccaaabbb
I would like to see such matches in the end:
1: Array
(
[1] =>
[2] => bbb
)
2: Array
(
[1] => aaa
[2] => bbb
)
How can I match both in one RegExp?
Here is my attempt:
#(aaa)?(.*)$#
I tried many options for greedy and jagged modifications, but that didn't work. As soon as I add '?' everything is agreed in [2]. Creating [2] bumps does not help.
My RegExp works as expected if I omit 'ccc', but I have to allow other characters at the beginning ...
source
share