I seem to have confused myself with a preg_match regex I'm doing, so fresh eyes and help would be appreciated.
My current regex is as follows:
/<!--menu:start:\(([0-9])\,([0-9])\)-->(.*?)<!--menu:end-->/se
I am looking to make the number input and colon e.g. :(1,4) optional, so it would match:
<!--menu:start--><!--menu:end-->
or
<!--menu:start:(0,3)--><!--menu:end-->
Enclose with a non matching group and set it to optional : (?:...)?
/<!--menu:start(?::\(([0-9])\,([0-9])\))?-->(.*?)<!--menu:end-->/se
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With