⊗ppPmRgMdERCh 266 of 447 menu

Escaping Ordinary Characters in Regex in PHP

The modifier X causes the escaping of an ordinary character to result in an error. Without this operator, ordinary characters can be escaped, they will still represent themselves (exception: digits, they will become backreferences). Let's look at an example:

<?php preg_replace('#x\@x#X', '!', 'x@x'); // error, @ is not a special character ?>
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline