note 78473 added to reference.pcre.pattern.syntax

From: Date: Sat, 13 Oct 2007 17:32:24 +0000
Subject: note 78473 added to reference.pcre.pattern.syntax
Groups: php.notes 
Request: Send a blank email to php-notes+get-131368@lists.php.net to get a copy of this message
I use these functions all the time: <?php function regexpmetaspecialchars($ps_str, $ps_delimiter = '/') { $ha_replsearch = array('\\', '^', '$', '.', '[', ']', '|', '(', ')', '?', '*', '+', '{', '}', $ps_delimiter); $ha_replreplace = array('\\\\', '\\^', '\\$', '\\.', '\\[', '\\]', '\\|', '\\(', '\\)', '\\?', '\\*', '\\+', '\\{', '\\}', '\\' . $ps_delimiter); return str_replace($ha_replsearch, $ha_replreplace, $ps_str); } function regexpmetabracketspecialchars($ps_str, $ps_delimiter = '/') { $ha_replsearch = array('\\', '^', '-', ']', $ps_delimiter); $ha_replreplace = array('\\\\', '\\^', '\\-', '\\]', '\\' . $ps_delimiter); return str_replace($ha_replsearch, $ha_replreplace, $ps_str); } function regexpmetareplacespecialchars($ps_str) { $ha_replsearch = array('\\', '$'); $ha_replreplace = array('\\\\', '\\$'); return str_replace($ha_replsearch, $ha_replreplace, $ps_str); } // Function aliases: // function regexpspecialchars($ps_str, $ps_delimiter = '/') { return regexpmetaspecialchars($ps_str, $ps_delimiter = '/'); } function regexpbracketspecialchars($ps_str, $ps_delimiter = '/') { return regexpmetabracketspecialchars($ps_str, $ps_delimiter = '/'); } function regexpreplacespecialchars($ps_str) { return regexpmetareplacespecialchars($ps_str); } ?> ---- Server IP: 194.145.210.3 Probable Submitter: 82.153.209.218 ---- Manual Page -- http://www.php.net/manual/en/reference.pcre.pattern.syntax.php Edit -- https://master.php.net/note/edit/78473 Del: integrated -- https://master.php.net/note/delete/78473/integrated Del: useless -- https://master.php.net/note/delete/78473/useless Del: bad code -- https://master.php.net/note/delete/78473/bad+code Del: spam -- https://master.php.net/note/delete/78473/spam Del: non-english -- https://master.php.net/note/delete/78473/non-english Del: in docs -- https://master.php.net/note/delete/78473/in+docs Del: other reasons-- https://master.php.net/note/delete/78473 Reject -- https://master.php.net/note/reject/78473 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131368) next »