Matching any character in a javascript regular expression
In Javascript, as with most languages, when writing regular expressions the . character can be used to match any character except for white space characters. So what if you want to match all characters in your regular expressions, including white space? The answer is to use [\s\S] instead. The \s expression matches any white space character and the \S expression matches any character that is not white space. Since everything is either white space or not, this will cause your regular expression to match all characters, include white space.
| Rating: | 100% positive, 4 total Votes |
| Categories: | javascript regexp programming |
| Added: | on Aug 18, 2008 at 9:06 am |
| Added By: | an anonymous user |
| Searches: | character javascript expression white space |

