You are here: Re: [PHP] Regex help « PHP « IT news, forums, messages
Re: [PHP] Regex help

Posted by Curt Zirzow on 01/14/06 10:18

On Fri, Jan 13, 2006 at 08:25:57AM -0500, Mike Smith wrote:
> 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 )/

The biggest problem with trying to match a string with regex is you
have to know the definition of what the string can be, for example
can the data be:

102-90 E 42 X 42 X 70 3/8
102-90 E 42 X 42 X 70 3/8
102-90 E 42X42X70 3/8
102-90 E 42\tX\t 42 \t X\n 70\r\n 3/8

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

If you want to just match those two numbers then:

/\s+(\d{1,2})\s+(X|x)\s+(\d{1,2})\s+(X|x)\s+/

>
>
> 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

If this is the case, where does the 102-90 E come from? This sounds
more like a data normalization issue than anything.

Curt.
--
cat .signature: No such file or directory

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация