Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <1670168.aK4W3vaeNJ@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Tue, 22 Nov 2011 13:30:32 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit Subject: Re: preg_match() oddities and question Newsgroups: comp.lang.php References: Followup-To: comp.lang.php MIME-Version: 1.0 Lines: 22 NNTP-Posting-Date: 22 Nov 2011 13:30:33 CET NNTP-Posting-Host: a6af8d56.newsspool3.arcor-online.net X-Trace: DXC=IZ3[kK5lmBK78PK[oJ2ng@McF=Q^Z^V3H4Fo<]lROoRA8kF\46n?EN3 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". PointedEars -- When all you know is jQuery, every problem looks $(olvable).