1

I've got this bit of code which finds occurrences of a string in a larger string. The following example works fine, it's looking for "Project Management"

preg_match_all("/\bProject Management\b/i", $content, $match_array);

However, if I want to search for say "c++" the following doesn't work:

preg_match_all("/\bc++\b/i", $content, $match_array);

I understand you have to escape the plus sign, so I have tried the following which also does not work:

preg_match_all("/\bc\+\+\b/i", $content, $match_array);

How can I search for "c++" using this bit of regex?

dlofrodloh
  • 1,728
  • 3
  • 23
  • 44

0 Answers0