Re: Regular Expressions
| From: | Marek Kilimajer | Date: | Thu, 15 Jul 2004 12:53:31 +0000 |
| Subject: | Re: Regular Expressions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190584@lists.php.net to get a copy of this message | ||
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, ArikDonno about regular expressions but with perl compatible you can use: preg_match('/Last Name:\s*(.*)\n/', $inputStr, $regs);