I am trying to match a string within the word boundary.
preg_match('/\bTORUK Cirque du Soleil\b/ims',
'Show: TORUK Cirque du Soleil with Lady Gaga', $matches);
Output: TORUK Cirque du Soleil
This works perfect. But when there are quotes in the string it doesn't work as expected. For example,
preg_match('/\bTORUK "Cirque du Soleil"\b/ims',
'Show: TORUK "Cirque du Soleil" with Lady Gaga', $matches);
It doesn't match at all. Expected output in this case is TORUK "Cirque du Soleil"
.
Tried using \B
i.e. non-word boundary, but breaks in strings where there are no quotes.
Have created a fiddle here.