You are here: Re: Regex pattern help « All PHP « IT news, forums, messages
Re: Regex pattern help

Posted by Rik on 05/27/06 15:38

robert wrote:
> "Rich" <rich@newsguy.com> wrote in message
> news:e5274n042f@drn.newsguy.com...
>> On Wed, 24 May 2006 03:48:14 GMT, Neeper wrote...
>>>
>>> I've got this pattern that I am using but how would I incorporate
>>> allowance of dashes(-)?
>>>
>>> $mixedPattern = '[^A-Za-z0-9\.\,\'\#[:space:]]';
>>>
>>>
>>> TIA
>>
>> If it's similar to the regex in Perl, I believe you put the dash
>> last in the group so that is isn't interpreted as a special
>> characters (such as the A-Z range).
>>
>> Rich
>
> somewhat true...it only needs to be escaped in a character
> class...i.e. [^\-] ... otherwise, it's just plain ol' -


Oh no, not that discussion again :-).

In PHP, both:
'[^A-Za-z0-9\.\,\'\#[:space:]-]'
and
'[^A-Za-z0-9\.\,\'\#[:space:]\-]'
will work.

I'm NOT going to say wether one is better, preferred, or 'standard'..... :P

Grtz
--
Rik Wasmus

 

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

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