On Monday 15 January 2007 20:59, Curt Zirzow wrote: > On 1/15/07, Beauford <phpuser@xxxxxxxxxx> wrote: > > Hi, > > > > Hopefully this is my last question so I can put this site to bed. Is > > there a good article that explains how to do the patterns for eregi. > > Honestly i hope it isn't the last question. > > As far as eregi articles that really has been dead since about php > 4.0.4, php onlu used eregi because pcre was not enable by default. > > > I have read tons of articles, but none really explains what everything > > means. Like why some things have square brackets and some have round, > > what does the * and $ do? Etc. > > > > i.e. > > > > "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]{1,})*\.([a-z]{2,}) > >{1} $" > > match, from the beggining of the line any thing that starts with > [_+a-z0-9-] one or more times followed by an optional value of > multiple values of \.[_+a-z0-9-], and ensuring a @ is included. > > then it is required to have one or more value of [a-z0-9-] followed by > the supper complicated expression (but not complete) that must be > defined once: > - can have zero or more of \.[a-z0-9-]{1,}) > - can have zero or more (\.[a-z0-9-]{1,}) > - which a \. must exist > - and having at least 2 chars at the end ([a-z]{2,}) > > Basically a sore attempt in validating an email. > > > The problem I am having is I'm trying to create a small function to > > validate a web address. > > i.e. www.site.com (no http://). > > iirc, there are some tools that already exist to find this, how it is > done can complicate things. > > > I have tried "[a-z0-9]+.[a-z0-9]+.[a-z0-9]", but it only works partially. > > If I input www.bob I get an error - www.bob.com I get no error, but it > > doesn't stop. www.bob.com.bob.bob.bob also produces no error. How do I > > stop it after it matches the 3 patterns? > > Perhaps looking into regex coach, regex is a whole other language, > learning it besides php is a a tough task, even experts in regex get > confused and i'm just a novice in regex. And while regex coach does not deliver any new products for the linux release, you can try out kregexpedit witch'll basicly do the same, if yer on linux that is... > > Anyway drop eregi and use pcre (php.net/pcre) you might get better > results in your search. > > HTH, > Curt. -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php