I’m trying to convert a Python script into PHP.
The following 2 regular expressions work in Python:
'/\*\*([\w\n\(\)\[\]\.\*\'\"\-#|,@{}_<>=:/ ]+?)\*/'
'(?:\* ([\w\d\(\),\.\'\"\-\:#|/ ]+)|(?<= @)(\w+)(?: (.+))?)'
…however, if I try to run them in PHP I get:
Warning: preg_match_all() [function.preg-match-all]: Unknown modifier ']'
How come?
The reason is that PHP expects delimiters around its regexes, so it treats the first and second slash as delimiters and tries to parse what follows as modifiers.
Surround your regex with new delimiters and try again (I also removed some unnecessary backslashes):
Hint: Use RegexBuddy to do these things. It will take a regex written in language A and convert it to language B for you.