Maybe try this:
preg_match_all('/\b(?:(?:rural delivery)|(?:rd))(?: |\t)*\d/i',
$input, $matches, PREG_PATTERN_ORDER);
$matches = $matches[0];
On May 5, 5:19 pm, Mike Adams <[email protected]> wrote:
> Using this tool:http://www.spaweditor.com/scripts/regex/index.php
>
> Using this regex:
> /(\s[r|rural]+\s?[d|delivery]+\s*\d)/i
>
> Using this sample data set:
> "
> 2 West coast, Rural delivery 1
> 20 West Coast Road, RD2
> 222 Hard Road, RD 3, Tiparere
> 3 hard 11 hard
> 33 ford road rural Delivery 3
> 1 fords road rd 1
> 5 foo rd
> 6 left road rUrAl DeLiVeRy 2
> "
>
> Q1 ?
> Setting "preg_match_all" i am getting one false positive to sort out.
> That is across two lines. It is the "rd" at the end of "5 foo rd" and the 6
> starting the next line.
>
> Q2?
> Not sure why i get each result twice.
>
> TIA
--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]