Skip to content

Conversation

@mytory
Copy link

@mytory mytory commented Mar 18, 2019

PCRE2 is strict that the hyphen needs to be moved to the end, or escaped for this to work.

preg_match('/[\w-.]+/', '');

The above code should compile just fine with PHP 7.3 as well as older versions. Note how this new pattern escapes the hyphen (- to -).

cite from https://ayesh.me/Upgrade-PHP-7.3

PCRE2 is strict that the hyphen needs to be moved to the end, or escaped for this to work.

preg_match('/[\w\-.]+/', '');

The above code should compile just fine with PHP 7.3 as well as older versions. Note how this new pattern escapes the hyphen (- to \-).

cite from https://ayesh.me/Upgrade-PHP-7.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant