Reply to Re: Order of expression in preg_split

Your name:

Reply:


Posted by none on 02/16/06 22:22

Al13n wrote:
>>In a regular expression character class definition (the bit in the []s), a
>>hyphen denotes a range of characters, so [a-z] will match all lowercase
>>letters of the alphabet, and [0-9] will match all numbers from 0 to 9. If
>>you escape your hyphen, it doesn't matter where you put it in your class.
>>
>>$strDate = preg_split('/[\/\-\.]/', $my_date);
> Absolutely right. Also, this is rather trivial, but you shouldn't need to
> escape the . in a character class, it's only a token when used outside a
> character class. When inside a character class, the dot as well as
> quantifiers (like *, ? etc.) are interpreted as literals.

Allen and Dave:

Thanks very much for your help. I'm surprised that /[\.\/-]/ worked at
all! A better way to have written it would have been: #[./\-]# which
works great.

Thanks, again.

Ken

[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

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