I am writing a regular expression for parsing PHP annotations in a flexible way. Any improvements to the expression are welcome. /[\*\s]*@(?P<name>\w+[\\\w]*?)\s? (?P<value> (?: [\w\s\"\<\>\_\#\=\-\.\'\{\}:;,\*\(\)\[\]]*[^\R\*\s\/] ) (?:\s | $) )/gsxmu A demo can be found [here](https://regex101.com/r/zU1eQ5/5).