Regex help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to save myself some time by extracting certain variables
from a string:

102-90 E 42 X 42 X 70 3/8

I've been testing with: http://www.quanetic.com/regex.php
and have been somewhat successful. Using this pattern:
/[0-9]{2,}( X| x|x )/

I have:
102-90 E [!MATCH!] [!MATCH!] 70 3/8


Ideally what I want to do is update the db table that holds these records.
ID: 1
Unit: 102-90 E 42 X 42 X 70 3/8
Panel: 42
Width: 42
Height: 70 3/8

$pattern1 = '/[0-9]{2,}( X| x|x )/';
$units = array of units above
foreach($units AS $unit){
        preg_match($pattern1,$unit[1],$match);
        print_r($match);
        echo "Panel: ".$match[0];
}

The $match array is empty.

Actually looking at the data there are so many typos (imported from
Excel) that I will probably have to update by hand, but out of
curiosity now what would be a good regex for the info given?

Thanks,
Mike Smith

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux