Re: Regular Expressions
| From: | Red Wingate | Date: | Thu, 15 Jul 2004 20:15:20 +0000 |
| Subject: | Re: Regular Expressions | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190621@lists.php.net to get a copy of this message | ||
Oh guess it would be even better and faster to only use:
/Last Name:([^\n]*)/
and trim() the result :-)
-- red
Red Wingate wrote:
Yep, but to avoid his problem with empty Strings he should use something like: /Last Name: *(.*?)\n/ outerwise \s* will match the first newline and continue to the end of the next line ! Tim Van Wassenhove wrote:In article <20040715144024.00007d80@ariktab>, Arik Raffael Funke wrote:implement following pattern "Last Name:\s*(.*)\n".I get just 'Jason'. But what I currently get is: Jason Street: abcThis is behaviour because (.*) is greedy. As you noticed, it matched "Jason \nStreet:abc" /Last Name:\s+(.*?)\n/