When working with Regex I suggest trying it here: https://regex101.com/
This way you can put your test string in and tweak the regex until it matches as you want it, then paste the resulting code back into PHP. BTW you don't need the first and last / characters.. those are for PHP only.