[syntax=php]if (preg_match('#[\\/:\*\?"<>\|]+#', $text) === 1){ // it contains at least one of those. }[/syntax] I'm not 100% sure which characters need to be escape in the [] though.
jacek wrote:I'm not 100% sure which characters need to be escape in the [] though.
That depends on what.. umm that # thingy you choose (forgot the name, ill probably find it in php.net). # is the best for most cases, you can use any character but you must escape it in the regex.
I think it's called a hash sign/symbol. In the expression itself it's called an expression delimiter because it tells where the end and begin of the expression is (excluding the optional flag after the second delimiter).
Kamal wrote:That depends on what.. umm that # thingy you choose (forgot the name, ill probably find it in php.net). # is the best for most cases, you can use any character but you must escape it in the regex.
Well yeah, there are some control characters and the # in this case that would need to be escape, I just cant remember which of that list are control characters, I think I had a pretty good guess though,