note 69759 deleted from reference.pcre.pattern.syntax by colder

From: Date: Mon, 18 Jun 2007 18:07:32 +0000
Subject: note 69759 deleted from reference.pcre.pattern.syntax by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127569@lists.php.net to get a copy of this message
Note Submitter: sasq1 at go2 dot pl ---- Only a small correction to this regexp: %"(.+)"[\s]+((http|https|ftp|file)://[^\s]+?)(.*)%sU It's not necessary to write character class "[..]" if it only contains one character match. Instead of "[\s]+" you can write simply "\s+". The similar is for the character class "[^\s]+", which may be written as "\S+". The "\S" assertion matches all characters, that are NOT whitespace. After those corrections we get a little shorter and easier to read regexp [if we can say that ANY regexp is easy to read at all ;-D ]: %"(.+)"\s+((http|https|ftp|file)://\S+?)(.*)%sU The only miserable thing with this regexp is that it matches patterns like: "Some description" http://www.somepage.com/catalog/file.html but doesn't match links like this one: "Some description" www.somepage.com/catalog/file.html

« previous php.notes (#127569) next »