|
Posted by Mike Smith on 01/13/06 15:25
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
Navigation:
[Reply to this message]
|