jonniejoejonson Posted September 14, 2009 Share Posted September 14, 2009 I know what preg_match('/^\w+$/',$string); does.. however it is the '/^\w+$/' part what chars does it actually lok for.. and does anyone know of a site that lists the different ways to write these expressions.. eg: "[^A-Za-z0-9]" regards J Link to comment https://forums.phpfreaks.com/topic/174186-solved-preg_matchwstring/ Share on other sites More sharing options...
Zane Posted September 14, 2009 Share Posted September 14, 2009 There's a good tutorial on Regex Basics on the main site Link to comment https://forums.phpfreaks.com/topic/174186-solved-preg_matchwstring/#findComment-918251 Share on other sites More sharing options...
Garethp Posted September 14, 2009 Share Posted September 14, 2009 It searchs [A-Za-z] \w is word characters. \d is digits. \s is whitespace Link to comment https://forums.phpfreaks.com/topic/174186-solved-preg_matchwstring/#findComment-918265 Share on other sites More sharing options...
Adam Posted September 14, 2009 Share Posted September 14, 2009 It searchs [A-Za-z] \w is word characters. \d is digits. \s is whitespace \w matches: a-z A-Z 0-9 _ Basically all it does is match a string that consists of *only* those characters I just listed above, and is 1 or more character in length. Link to comment https://forums.phpfreaks.com/topic/174186-solved-preg_matchwstring/#findComment-918270 Share on other sites More sharing options...
.josh Posted September 14, 2009 Share Posted September 14, 2009 it also may match additional characters based on locale settings. For portability, safest bet is to not use shortcut classes. Link to comment https://forums.phpfreaks.com/topic/174186-solved-preg_matchwstring/#findComment-918346 Share on other sites More sharing options...
jonniejoejonson Posted September 18, 2009 Author Share Posted September 18, 2009 Thanks for your responses. Link to comment https://forums.phpfreaks.com/topic/174186-solved-preg_matchwstring/#findComment-920599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.