Hi Jason,

@ 2:40:34 AM on 4/20/2001, Jason Caldwell wrote:

> I'm a little lost as to the exact function of the following:

> ^ and $

^ beginning of a string.
$ end of a string.

> 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

Matches the expression with one or more alnum's before the \. and one
or more after the \.

! is [:punct:]

> aaa.!  <-- no match

No alnum after the \. If you want to match that, replace the + with a
*

> after I put the $ on the end

> aaa.a! <-- no match

Doesn't match the expression \.[[:alnum:]]+$

> 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?

Yep; more precisely, ^[something]$ matches the whole string.


-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]

Reply via email to