Re: preg_match() oddities and question [message #176071 is a reply to message #176069] |
Tue, 22 November 2011 12:55 |
Sandman
Messages: 32 Registered: August 2011
Karma:
|
Member |
|
|
In article <1670168(dot)aK4W3vaeNJ(at)PointedEars(dot)de>,
Thomas 'PointedEars' Lahn <PointedEars(at)web(dot)de> wrote:
> Sandman wrote:
>
>> So I have this regexp:
>>
>> if (preg_match("/^(.*?)\s*(\d*?)\s*([A-Z,a-z,-]*?)$/", $search, $m)){
>> $streetname = uc_words($m[1]);
>> $streetnumber = trim($m[2]);
>> $streetletter = strtoupper($m[3]);
>> $search = trim($streetname . SPACE . $streetnumber .
>> $streetletter);
>> }
>>
>> The desired result is taki9ng the input ($search) and split it into
>> its parts as an address, right? $search can be, for example, "foo
>> street 34", "longstreet 45b", "longstreet 45 b" or just "longstreet".
>
> "10 East 42nd Street, New York, NY 10017, USA".
That wouldn't be a normal swedish address, no. :)
--
Sandman[.net]
|
|
|