Reply to Re: idiot question about preg_match and regex

Your name:

Reply:


Posted by Michael Winter on 10/28/27 11:30

On 27/10/2005 14:28, lkrubner@geocities.com wrote:

[snip]

> function checkForFloatingPoint($input=false) {

I don't really see how boolean false is a useful default value, or even
why you'd want a default argument for the input.

What is this function supposed to do? Exactly what pattern(s) are you
trying to match or test for? It's identifier suggests that it should
look for some aspect of a floating-point number (though it's not clear
what), yet your pattern allows integers as well.

> $pattern = "[-+]?([0-9]*\.[0-9]+|[0-9]+)";

You haven't included any delimiters. A forward slash, at both the start
and end of the pattern, is common.

> $match = preg_match (pattern, subject);

You haven't included the dollar ($) symbol before each identifier.

[snip]

Mike


Don't use tabs to indent. Tabs are usually rendered with the equivalent
of eight spaces, which is far too much when content is usually wrapped
at eighty characters, or less. Use spaces; preferably two.

--
Michael Winter
Prefix subject with [News] before replying by e-mail.

[Back to original 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

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