You are here: match any character but « PHP Programming Language « IT news, forums, messages
match any character but

Posted by Jon Slaughter on 05/05/07 09:29

Can I use any reg exp(mainly for mod rewrite) where I can match any
character but a fixed list?

I need to match a string that does not contain any /'s but I don't want to
have to use a character search string. (I don't see any need to have to
hardcode it)

that is,

..

matches any single charactr

and (.*) matches any string

what I want to do is use something like % that means

..%/

which means match any character but /.

Of course it would need to be valid and I know I can't make up semantics for
the reg ex. My point is is that, is that I don't want to have to use
[a-z0-9\-%&^$#@!etc...] to mean . but not /.

Surely there is a way to exclude a few characters from . without having to
increase the complexity of the expression 1000 fold?

If you don't get that, then a simple example would be that I have an
arbitrary string and I want to match only if that string does not contain an
a. Sure I can so something like
[bcdefghijklmnopqrstuv1234567890!@#$%^&*()_+][';/.,<>?:"{}+-=~`..........................]
but surely reg exp has an easier way??? (again, this is specifically for mod
rewrite)


Thanks,
Jon

 

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

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