Re: [PHP] FW: Eregi question



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.

Anyway drop eregi and use pcre (php.net/pcre) you might get better
results in your search.

HTH,
Curt.
.



Relevant Pages

  • Re: [PHP] FW: Eregi question
    ... there a good article that explains how to do the patterns for eregi. ... As far as eregi articles that really has been dead since about php ... Perhaps looking into regex coach, regex is a whole other language, ... And while regex coach does not deliver any new products for the linux release, ...
    (php.general)
  • [Full-disclosure] PHP 5.4/5.3 deprecated eregi() memory_limit bypass
    ... memory_limit poc ... Functions based on POSIX Regular Expression eg. eregi, ... It allow us to bypass memory_limit in PHP. ... Multiple BSD libc/regcompMultiple Vulnerabilities ...
    (Full-Disclosure)
  • PHP 5.4/5.3 deprecated eregi() memory_limit bypass
    ... memory_limit poc ... Functions based on POSIX Regular Expression eg. eregi, are deprecated since PHP 5.3. ... Multiple BSD libc/regcompMultiple Vulnerabilities ...
    (Bugtraq)
  • Re: Contact Form
    ... Really appreciate help and sure leanred php alot in one week! ... I tried full header addy and various tricks but no ... eregi, it failed to validate email with "@". ...
    (comp.lang.php)