PHP regex splitting a string into two
one text
Solution:
You could match any char except ,
for the first part and any char except a "
between the double quotes for the second part using a negated character class which starts with [^
\bEQUAL\s*\([^,]+,\s*"[^"]+"\)
Note that currently using \s*
and the negated character class, the pattern can also span newlines as \s
also matches a newline and the negated character class matches any char except for the listed.
If there should only be a match on the same line, you can exclude matching the newlines from the negated character class and use \h
to match a horizontal whitespace char.
\bEQUAL\h*\([^,\r\n]+,\h*"[^"\r\n]+"\)
Source