PHP正则表达式帮助 - 匹配东西=“某事物”与转义单引号

Trying to find a regular expression to handle this string using PHP preg_match_all:

include='Track Ass\'y'

The regex should be able to handle single OR double quotes, but not break on the escaped quote. Currently the regex in place looks like this:

/([^ ]*?)=["|'](.*?)(["|'])/

This breaks on the ' and only matches up to the single quote, and misses the final y'. Help?

It's stopping before the y because of your lazy-match ?.

Remove the second question mark:

(.*)
([^ ]*?)=["|'](.*?)(["|']\w['|"])

..works:

enter image description here

try using a webtool to debug your regex.