note 19702 added to ref.regex

From: Date: Fri, 08 Mar 2002 03:33:15 +0000
Subject: note 19702 added to ref.regex
Groups: php.notes 
Request: Send a blank email to php-notes+get-27501@lists.php.net to get a copy of this message
Follow-up to my previous post: Some simple optimization allowed me to realize that excluding a word at the beginning of a string has a degree of complexity O(n) rather than O(n^2). I only had to follow the logic: if str[0] != badword[0] then OK else if str[1] != badword[1] then OK else if str[2] != badword[2] then OK else ... So excluding the word 'abc' at the beginning of a string is much more simple than I had made it out to be: ^([^a]|a[^b]|ab[^c]) -- http://www.php.net/manual/en/ref.regex.php http://master.php.net/manage/user-notes.php?action=edit+19702 http://master.php.net/manage/user-notes.php?action=delete+19702 http://master.php.net/manage/user-notes.php?action=reject+19702

« previous php.notes (#27501) next »