preg_match & preg_replace
Në shqip: Shprehjet e rregullta në PHP
ShpjegimiSQ
PHP përdor regex PCRE me funksionet preg_*: preg_match() kontrollon/gjen, preg_match_all() gjen të gjitha, preg_replace() zëvendëson. Modeli shkruhet mes ndarësve: '/^\d+$/'.
EnglishEN
PHP uses PCRE regex with the preg_* functions: preg_match() checks/finds, preg_match_all() finds all, preg_replace() replaces. The pattern goes between delimiters: '/^\d+$/'.
Si ta mendosh
Si një sitë për tekste.
Lexoje në anglisht
Like a sieve for text.
Shembull kodiphp
if (preg_match('/^\+383\d{8}$/', $tel)) echo "Numër i vlefshëm";
$pa_hapesira = preg_replace('/\s+/', ' ', $teksti);