note 84794 added to function.preg-replace

From: Date: Wed, 30 Jul 2008 12:34:36 +0000
Subject: note 84794 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-142926@lists.php.net to get a copy of this message
I just was trying to make a negated replace with a string NOT being in another string. The code that is actually working: <?php $result = preg_replace('#{(?!disable1|disable2)[a-z0-9]+}#is', '$1', $foo); ?> This code matches on all strings that do NOT start with "disable1" or "disable2" and contain of a-z0-9. It took me several hours to figuere out this very easy example! Hope anyone could use it ---- Server IP: 217.13.201.10 Probable Submitter: 212.25.4.54 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- https://master.php.net/note/edit/84794 Del: integrated -- https://master.php.net/note/delete/84794/integrated Del: useless -- https://master.php.net/note/delete/84794/useless Del: bad code -- https://master.php.net/note/delete/84794/bad+code Del: spam -- https://master.php.net/note/delete/84794/spam Del: non-english -- https://master.php.net/note/delete/84794/non-english Del: in docs -- https://master.php.net/note/delete/84794/in+docs Del: other reasons-- https://master.php.net/note/delete/84794 Reject -- https://master.php.net/note/reject/84794 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#142926) next »