Newbie needs help with regular expression

Hi,

Please can someone help regarding providing a regular expression for entering
a set of characters with letters, numbers, periods (.), hyphens (-), or
underscores (_) only.

I've got as far as this:

$pattern="^([_a-z0-9-]+)(\.[_a-z0-9-])$";

Thank you in advance.

Kind regards,

Raj (newbie)
raj [ Fr, 16 Februar 2007 11:19 ] [ ID #1631494 ]

Re: Newbie needs help with regular expression

$patterns = "/[^a-z0-9.-_]/i";
if (preg_match ($patterns, $word))
echo "not allowed";
else
echo "allowed";

--
http://ascii.mastervb.net -- ASCII Art Generator
http://anagram.mastervb.net -- Anagram Generator
http://www.mastervb.net/phpbooks/ -- Best PHP MySQL Books

On Feb 16, 5:19 pm, raj <r... [at] nospam.com> wrote:
> Hi,
>
> Please can someone help regarding providing a regular expression for entering
> a set of characters with letters, numbers, periods (.), hyphens (-), or
> underscores (_) only.
>
> I've got as far as this:
>
> $pattern="^([_a-z0-9-]+)(\.[_a-z0-9-])$";
>
> Thank you in advance.
>
> Kind regards,
>
> Raj (newbie)
lorento [ Fr, 16 Februar 2007 11:35 ] [ ID #1631496 ]

Re: Newbie needs help with regular expression

Hi,

Is there an ereg equivalent please.

Thank you in advance,

Raj

On Fri, 16 Feb 2007 10:35:17 +0000, lorento wrote
(in article <1171622115.950808.192540 [at] p10g2000cwp.googlegroups.com>):

> $patterns = "/[^a-z0-9.-_]/i";
> if (preg_match ($patterns, $word))
> echo "not allowed";
> else
> echo "allowed";
>
> --
> http://ascii.mastervb.net -- ASCII Art Generator
> http://anagram.mastervb.net -- Anagram Generator
> http://www.mastervb.net/phpbooks/ -- Best PHP MySQL Books
>
> On Feb 16, 5:19 pm, raj <r... [at] nospam.com> wrote:
>> Hi,
>>
>> Please can someone help regarding providing a regular expression for
>> entering
>> a set of characters with letters, numbers, periods (.), hyphens (-), or
>> underscores (_) only.
>>
>> I've got as far as this:
>>
>> $pattern="^([_a-z0-9-]+)(\.[_a-z0-9-])$";
>>
>> Thank you in advance.
>>
>> Kind regards,
>>
>> Raj (newbie)
>
>
raj [ Fr, 16 Februar 2007 12:08 ] [ ID #1631499 ]

Re: Newbie needs help with regular expression

$patterns = "/[^a-z0-9.-_]/i";
if (preg_match ($patterns, $word))
echo "not allowed";
else
echo "allowed";

--
http://ascii.mastervb.net -- ASCII Art Generator
http://anagram.mastervb.net -- Anagram Generator
http://www.mastervb.net/phpbooks/ -- Best PHP MySQL Books

On Feb 16, 5:19 pm, raj <r... [at] nospam.com> wrote:
> Hi,
>
> Please can someone help regarding providing a regular expression for entering
> a set of characters with letters, numbers, periods (.), hyphens (-), or
> underscores (_) only.
>
> I've got as far as this:
>
> $pattern="^([_a-z0-9-]+)(\.[_a-z0-9-])$";
>
> Thank you in advance.
>
> Kind regards,
>
> Raj (newbie)
lorento [ Fr, 16 Februar 2007 11:35 ] [ ID #1631523 ]

Re: Newbie needs help with regular expression

Hi,

Is there an ereg equivalent please.

Thank you in advance,

Raj

On Fri, 16 Feb 2007 10:35:17 +0000, lorento wrote
(in article <1171622115.950808.192540 [at] p10g2000cwp.googlegroups.com>):

> $patterns = "/[^a-z0-9.-_]/i";
> if (preg_match ($patterns, $word))
> echo "not allowed";
> else
> echo "allowed";
>
> --
> http://ascii.mastervb.net -- ASCII Art Generator
> http://anagram.mastervb.net -- Anagram Generator
> http://www.mastervb.net/phpbooks/ -- Best PHP MySQL Books
>
> On Feb 16, 5:19 pm, raj <r... [at] nospam.com> wrote:
>> Hi,
>>
>> Please can someone help regarding providing a regular expression for
>> entering
>> a set of characters with letters, numbers, periods (.), hyphens (-), or
>> underscores (_) only.
>>
>> I've got as far as this:
>>
>> $pattern="^([_a-z0-9-]+)(\.[_a-z0-9-])$";
>>
>> Thank you in advance.
>>
>> Kind regards,
>>
>> Raj (newbie)
>
>
raj [ Fr, 16 Februar 2007 12:08 ] [ ID #1631524 ]

Re: Newbie needs help with regular expression

$patterns = "/[^a-z0-9.-_]/i";
if (preg_match ($patterns, $word))
echo "not allowed";
else
echo "allowed";

--
http://ascii.mastervb.net -- ASCII Art Generator
http://anagram.mastervb.net -- Anagram Generator
http://www.mastervb.net/phpbooks/ -- Best PHP MySQL Books

On Feb 16, 5:19 pm, raj <r... [at] nospam.com> wrote:
> Hi,
>
> Please can someone help regarding providing a regular expression for entering
> a set of characters with letters, numbers, periods (.), hyphens (-), or
> underscores (_) only.
>
> I've got as far as this:
>
> $pattern="^([_a-z0-9-]+)(\.[_a-z0-9-])$";
>
> Thank you in advance.
>
> Kind regards,
>
> Raj (newbie)
lorento [ Fr, 16 Februar 2007 11:35 ] [ ID #1631618 ]

Re: Newbie needs help with regular expression

Hi,

Is there an ereg equivalent please.

Thank you in advance,

Raj

On Fri, 16 Feb 2007 10:35:17 +0000, lorento wrote
(in article <1171622115.950808.192540 [at] p10g2000cwp.googlegroups.com>):

> $patterns = "/[^a-z0-9.-_]/i";
> if (preg_match ($patterns, $word))
> echo "not allowed";
> else
> echo "allowed";
>
> --
> http://ascii.mastervb.net -- ASCII Art Generator
> http://anagram.mastervb.net -- Anagram Generator
> http://www.mastervb.net/phpbooks/ -- Best PHP MySQL Books
>
> On Feb 16, 5:19 pm, raj <r... [at] nospam.com> wrote:
>> Hi,
>>
>> Please can someone help regarding providing a regular expression for
>> entering
>> a set of characters with letters, numbers, periods (.), hyphens (-), or
>> underscores (_) only.
>>
>> I've got as far as this:
>>
>> $pattern="^([_a-z0-9-]+)(\.[_a-z0-9-])$";
>>
>> Thank you in advance.
>>
>> Kind regards,
>>
>> Raj (newbie)
>
>
raj [ Fr, 16 Februar 2007 12:08 ] [ ID #1631621 ]

Re: Newbie needs help with regular expression

I think you better use preg because faster than ereg. I heard that
ereg will be deprecated.

--
http://loan.mastervb.net
http://ascii.mastervb.net

On Feb 16, 6:08 pm, raj <r... [at] nospam.com> wrote:
> Hi,
>
> Is there an ereg equivalent please.
>
> Thank you in advance,
>
> Raj
>
> On Fri, 16 Feb 2007 10:35:17 +0000, lorento wrote
> (in article <1171622115.950808.192... [at] p10g2000cwp.googlegroups.com>):
>
> > $patterns = "/[^a-z0-9.-_]/i";
> > if (preg_match ($patterns, $word))
> > echo "not allowed";
> > else
> > echo "allowed";
>
> > --
> >http://ascii.mastervb.net-- ASCII Art Generator
> >http://anagram.mastervb.net-- Anagram Generator
> >http://www.mastervb.net/phpbooks/-- Best PHP MySQL Books
>
> > On Feb 16, 5:19 pm, raj <r... [at] nospam.com> wrote:
> >> Hi,
>
> >> Please can someone help regarding providing a regular expression for
> >> entering
> >> a set of characters with letters, numbers, periods (.), hyphens (-), or
> >> underscores (_) only.
>
> >> I've got as far as this:
>
> >> $pattern="^([_a-z0-9-]+)(\.[_a-z0-9-])$";
>
> >> Thank you in advance.
>
> >> Kind regards,
>
> >> Raj (newbie)
lorento [ Mo, 19 Februar 2007 03:29 ] [ ID #1633853 ]

Re: Newbie needs help with regular expression

I think you better use preg because faster than ereg. I heard that
ereg will be deprecated.

--
http://loan.mastervb.net
http://ascii.mastervb.net

On Feb 16, 6:08 pm, raj <r... [at] nospam.com> wrote:
> Hi,
>
> Is there an ereg equivalent please.
>
> Thank you in advance,
>
> Raj
>
> On Fri, 16 Feb 2007 10:35:17 +0000, lorento wrote
> (in article <1171622115.950808.192... [at] p10g2000cwp.googlegroups.com>):
>
> > $patterns = "/[^a-z0-9.-_]/i";
> > if (preg_match ($patterns, $word))
> > echo "not allowed";
> > else
> > echo "allowed";
>
> > --
> >http://ascii.mastervb.net-- ASCII Art Generator
> >http://anagram.mastervb.net-- Anagram Generator
> >http://www.mastervb.net/phpbooks/-- Best PHP MySQL Books
>
> > On Feb 16, 5:19 pm, raj <r... [at] nospam.com> wrote:
> >> Hi,
>
> >> Please can someone help regarding providing a regular expression for
> >> entering
> >> a set of characters with letters, numbers, periods (.), hyphens (-), or
> >> underscores (_) only.
>
> >> I've got as far as this:
>
> >> $pattern="^([_a-z0-9-]+)(\.[_a-z0-9-])$";
>
> >> Thank you in advance.
>
> >> Kind regards,
>
> >> Raj (newbie)
lorento [ Mo, 19 Februar 2007 03:29 ] [ ID #1633877 ]

Re: Newbie needs help with regular expression

I think you better use preg because faster than ereg. I heard that
ereg will be deprecated.

--
http://loan.mastervb.net
http://ascii.mastervb.net

On Feb 16, 6:08 pm, raj <r... [at] nospam.com> wrote:
> Hi,
>
> Is there an ereg equivalent please.
>
> Thank you in advance,
>
> Raj
>
> On Fri, 16 Feb 2007 10:35:17 +0000, lorento wrote
> (in article <1171622115.950808.192... [at] p10g2000cwp.googlegroups.com>):
>
> > $patterns = "/[^a-z0-9.-_]/i";
> > if (preg_match ($patterns, $word))
> > echo "not allowed";
> > else
> > echo "allowed";
>
> > --
> >http://ascii.mastervb.net-- ASCII Art Generator
> >http://anagram.mastervb.net-- Anagram Generator
> >http://www.mastervb.net/phpbooks/-- Best PHP MySQL Books
>
> > On Feb 16, 5:19 pm, raj <r... [at] nospam.com> wrote:
> >> Hi,
>
> >> Please can someone help regarding providing a regular expression for
> >> entering
> >> a set of characters with letters, numbers, periods (.), hyphens (-), or
> >> underscores (_) only.
>
> >> I've got as far as this:
>
> >> $pattern="^([_a-z0-9-]+)(\.[_a-z0-9-])$";
>
> >> Thank you in advance.
>
> >> Kind regards,
>
> >> Raj (newbie)
lorento [ Mo, 19 Februar 2007 03:29 ] [ ID #1633895 ]
PHP » alt.php » Newbie needs help with regular expression

Vorheriges Thema: Above Black
Nächstes Thema: FAQ... should we have one?