Nov 28, 2006 #1 MarkZK Technical User Jul 13, 2006 202 GB Hi, could somebody tell me what the regular expression is to match any length of characters and any character except the space (white space), thanks.
Hi, could somebody tell me what the regular expression is to match any length of characters and any character except the space (white space), thanks.
Nov 28, 2006 1 #2 kaht Programmer Aug 18, 2003 4,156 US /^[^ ]*$/ will match any string (including an empty string) that is made up of any characters other than spaces. /^[^ ]+$/ will match any string (not including empty strings) that is made up of any characters other than spaces. /^\S*$/ will match any string made that is made up of any non-white characters (so it will not match newline or line feed or tabs, etc.) And of course you can change the above regexp to have a + instead of * if you don't want to match empty strings. -kaht http://www.silkypups.com [small](All puppies have now found loving homes, thanks for all who showed interest)[/small] Upvote 0 Downvote
/^[^ ]*$/ will match any string (including an empty string) that is made up of any characters other than spaces. /^[^ ]+$/ will match any string (not including empty strings) that is made up of any characters other than spaces. /^\S*$/ will match any string made that is made up of any non-white characters (so it will not match newline or line feed or tabs, etc.) And of course you can change the above regexp to have a + instead of * if you don't want to match empty strings. -kaht http://www.silkypups.com [small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
Nov 28, 2006 Thread starter #3 MarkZK Technical User Jul 13, 2006 202 GB Bingo, the third one sounds perfect, Thank you very much. Upvote 0 Downvote