Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
<?php // Match Unicode letters (any script) preg_match("/^\p{L}+$/u", "Привет"); // matches Russian preg_match("/^\p{L}+$/u", "مرحبا"); // matches Arabic preg_match("/^\p{L}+$/u", "Hello"); // matches English // Match Unicode digits (includes Arabic-Indic numerals) preg_match("/\p{Nd}+/u", "١٢٣"); // Arabic-Indic digits // Count characters correctly (mb_ functions) echo mb_strlen("café"); // 4 (not strlen: 5 bytes) // Unicode word boundary issues preg_match("/\bjava\b/iu", "JavaScript"); // may not work as expected with Unicode
Result
Open