Arik Raffael Funke wrote:
Hello together,

I am havin trouble with php regular expressions. I would like to
implement following pattern "Last Name:\s*(.*)\n".

- From following text,
Name: James
Last Name: Jason
Street: abc

I get just 'Jason'. But what I currently get is:
Jason
Street: abc

Obviously the new-line is missed. Any thoughts on this?

sample code:
ereg("Last Name:\s*(.*)\n", $strInput, $regs)
echo $regs[1];

Thanks for the help!

Cheers,
Arik

Donno about regular expressions but with perl compatible you can use:

preg_match('/Last Name:\s*(.*)\n/', $inputStr, $regs);

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



Reply via email to