Thats what the book said too... but what I'm confused about is the word
START and END -- at what point does the start end, and the end begin?  If
you look at my example below

aaa.a!  <-- matched
>
> aaa.!  <-- no match
>
> after I put the $ on the end
>
> aaa.a! <-- no match
>
> aaa.aa32 <-- match...

It looks like the ^ and $ are actually needed it you want the expression to
work correctly *at all*.

Thanks.
Jason


""Jack Dempsey"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> if you put ^ at the start of your regexp, that means you want the start of
> the string to match your expression...$ is used for the end of the
string...
>
> -jack
>
> -----Original Message-----
> From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 20, 2001 2:41 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Regular Expressions?
>
>
> I'm a little lost as to the exact function of the following:
>
> ^ and $
>
> I noticed in the example below... that when I added the $ to the end of
the
> expression, I wasn't able anymore to put a non-alphanumeric character in
the
> end, for example (without the $)
>
> I was able to enter the following and get a 'match'
>
> aaa.a!  <-- matched
>
> aaa.!  <-- no match
>
> after I put the $ on the end
>
> aaa.a! <-- no match
>
> aaa.aa32 <-- match...
>
> So, am I to understand that the ^ and $ are used to tell the expression
that
> it *must* match what the expression expects?  I guess why I'm so confused
is
> because -- I thought when you create an expression, that it must match the
> parameters of that expression... then what are the ^ $ for??  It's like to
> create an expression, but it truly won't work unless you have it turned on
> with ^ $ characters.
>
> Thanks.
> Jason
>
>
>
> "Brian Clark" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi Jason,
> >
> > @ 1:43:19 AM on 4/20/2001, Jason Caldwell wrote:
> >
> > ...
> > > I want to match any of the following:
> >
> > > 1.1 or a.a
> >
> > > or 1111.1111 or aaaa.aaaa    <-- any number of digits (0-9) or alpha
> (a-z)
> > > on either side of the dot.
> >
> > > if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x]))
> >
> > Your parentheses are slightly wrong.
> >
> > if(
> >   eregi(
> >     "^
> >       (
> >       /* unmatched parens */
> >
> >       [0-9][a-z]
> >       /* only matches one digit or character */
> >
> >       \.
> >       /* matches period */
> >
> >       [0-9][a-z]
> >       /* only matches one digit or character */
> >     ",
> >  $myArray[x]
> >  )
> >  /* syntax error :) */
> > )
> >
> > > Is this correct?  I think I'm missing something.
> >
> > You want something like this:
> >
> > <?php
> >
> > /* eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $myArray[x]) */
> >
> > $string = 'aaa.aaa';
> > $string_2 = 'aaaaaa';
> >
> > print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ? 'matched' : 'no
> match');
> > print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string_2) ? 'matched' :
'no
> match');
> >
> > ?>
> >
> > > Thanks.
> > > Jason
> >
> > -Brian
> > --
> >  PGP is spoken here: 0xE4D0C7C8
> >  Please, DO NOT carbon copy me on list replies.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to