I'm having trouble matching specific string using backtracking.
Here is the example strings to be matched.
- Warning</b>: include(db.inc.php) [<a
href='function.include'>function.include</a>]:
- Warning</b>: mysql_real_escape_string() [<a
href='function.mysql-real-escape-string'>function.mysql-real-escape-string
Regex:
warning<\/b>\:\s++(.*)\(.*?\)\s\[<a\shref='(function.\1)'>\2/m
The above regex would match the first example, but it will fail for the second example. As the first capture group with more than one word "mysql_real_escape" will have "_" in between.
Is there any way that I can replace "_" in \1 with "-" before matching.
Regex engine: PCRE