Skip to content

Instantly share code, notes, and snippets.

@graste
Created February 27, 2026 11:08
Show Gist options
  • Select an option

  • Save graste/7ba623726609dda6fb451f39789fbacc to your computer and use it in GitHub Desktop.

Select an option

Save graste/7ba623726609dda6fb451f39789fbacc to your computer and use it in GitHub Desktop.
differences for character class \w in php 8.3 and php 8.4 due to https://php.watch/versions/8.4/pcre2-regexp-syntax-changes
<?php
$s = "ΟδόςÏ Í J J̈";
foreach (preg_split("//u",$s,-1,PREG_SPLIT_NO_EMPTY) as $c) {
printf(
"%s U+%04X => %s (\w=%s)\n",
$c,
\IntlChar::ord($c),
preg_match("/^[\w\s\-,.\x{00C0}-\x{017F}]$/u",$c) ? "MATCH" : "NO",
preg_match("/^\w$/u",$c) ? "Y" : "N"
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment