-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 15 Jul 2004 08:02:13 -0500
"Matt M." <[EMAIL PROTECTED]> wrote:

> > Obviously the new-line is missed. Any thoughts on this?
> > 
> > sample code:
> > ereg("Last Name:\s*(.*)\n", $strInput, $regs)
> > echo $regs[1];
> 
> try this:
> 
> ereg("Last Name:\s*(.*[^\n])", $strInput, $regs);
> echo $regs[1];
> 

Thanks for the quick help.

Both ways,
preg_match('/Last Name:\s*(.*)\n/', $inputStr, $regs);
and
ereg("Last Name:\s*(.*[^\n])", $strInput, $regs);
work fine.

However if I have,
Last Name:
Street: Teststreet
(no entry after last name)

Both search strings return me:
- ----

Street: Teststreet
- ----

Also why doesn't "Last Name:\s*(.*)$" work, and neither "^Last
Name:\s*(.*)". Both strings are not found at all - that's why I thought
the php implementation might treat new lines in a strange way.

Can anybody explain these effects to me?

Cheers,
Arik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFA9oN1//PXyz2NiW8RAmCQAJ9wRDxc8YDyfU+4EoNeRsqMKJDPBQCgsMvv
7cpFD6cYZuckqGdY+1Gtqi8=
=Hi/P
-----END PGP SIGNATURE-----

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to