On Friday 27 July 2012 15:58:07 Andy Bach wrote:

> Your RE is a bit odd - all that 'non-greedy *' -ness implies troubles.
>  The first "space star ?" can be greedy, right? You want all the
> spaces/white space in a row, or rather don't want - as you're anchored
> on the end, this doesn't do anything for the actual RE work. The next
> "word char *" means zero or more - you want at least one, right? Word
> char or non-white space?  The only requirement your RE looks for is
> the single blank between capture 1 and 2 - so
> Kia\tVenga
>
> won't work.  Actually anything w/o a blank will fail ... don't really
> know enough about your data but try maybe:
>  if ($model=~/(\S+)\s+(.*)\s*$/) {

Thanks Andy, Shawn and Jim.

The regex I'd supplied was built up over many attempts to get it working, 
hence the over the top spec.

The problem eventually turned out to be that the "space" between the make and 
model wasn't actually a space, i.e. wasn't ASCII 32. I have now got the 
people generating the data to generate it correctly and all is now fine, with 
a much simpler regex.

Gary


-- 
Gary Stainburn
Group I.T. Manager
Ringways Garages
http://www.ringways.co.uk 

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to