Re: Regular Expressions

From: Date: Thu, 15 Jul 2004 20:13:59 +0000
Subject: Re: Regular Expressions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-190620@lists.php.net to get a copy of this message
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: abc
This is behaviour because (.*) is greedy. As you noticed, it matched "Jason \nStreet:abc" /Last Name:\s+(.*?)\n/


« previous php.general (#190620) next »