Re: regex

From: Date: Fri, 07 Feb 2003 16:48:47 +0000
Subject: Re: regex
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-134751@lists.php.net to get a copy of this message
On Fri, Feb 07, 2003 at 05:29:49PM +0100, Marian Feiler wrote: > > i have to check if there's a dot in a string, and i need nothing but the > regex pattern for this... tryed a lot, but the dot itself means to matches > all. You can escape the dot either by putting a backslash in front of it or putting it inside square brackets. So: ereg("a.b","aaabbb"); is true, but ereg("a[.]b","aaabbb"); is false. Other "sensitive" characters can also be escaped in this way; the bracket expression [][.^$()|*+?-] matches any of those characters. And to match any *except* those characters, use [^][.^$()|*+?-]. Check the re_format(7) man page for details. If you don't have a unix box handy, check http://www.freebsd.org/cgi/man.cgi?query=re_format . -- Paul Chvostek <paul@it.ca> Operations / Abuse / Whatever it.canada, hosting and development http://www.it.ca/

« previous php.general (#134751) next »