Reply to Re: Regex help

Your name:

Reply:


Posted by Mitja Trampus on 10/11/05 01:50

BernieH wrote:
> I need a regex which will extract the year only from a variety of date
> strings such as -
>
> April 8, 2000
> 13 May 1999
> April 1999
> 1999
> 20050908 (yyyymmdd format)
>
> The year will always be either the 1st 4 or the last 4 characters of the
> string.

Then why regexes? Just cut off the first 4 and the last 4
characters, then see if any of them is a valid year (i.e.,
convert them to int and check something like 1900 < year <
2010).

[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

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