You are here: Re: regular expression help « PHP Programming Language « IT news, forums, messages
Re: regular expression help

Posted by Anno Siegel on 09/15/05 12:49

phal <betterdie@gmail.com> wrote in comp.lang.perl.misc:

Please post attributions and some context when you reply.

> ---------------------------------------
> If this is the regular expression
> /^\s*(\d+\.\d+)|(\.\d+)|(\d+)\s*$/
>
> How does this:
> 40:26:46.302N 79:56:55.903W
>
> ==========
> You can use this method
> =~/(\d{2}):(\d{2}):(\d{2})\.(\d{4})\s+(\d{2}):(\d{2}):(\d{2})\.(\d{4})/gi

Why the "/i"? It does nothing.

The OP doesn't want a regex that matches "40:26:46.302N 79:56:55.903W".
He was wondering why his original regex did match it and wanted it
corrected so that it doesn't.

> I don't know whether you want to slice the letter or not, but you still

Slice the letter?

> able to retireve it by this method.
> I haven't check whehter it is correctly run, i just type in as what i
> see.

Well, it doesn't match. Your regex requires \d{4}, twice. There is
no sequence of four digits in the given string.

All in all, a pretty useless contribution.

Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.

 

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

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