To find non-whitespace characters, use the following code −
\S
You can try to run the following code to find non-whitespace character −
<html> <head> <title>JavaScript Regular Expression</title> </head> <body> <script> var myStr = "100% Responsive!"; var reg = /\S/g; var match = myStr.match(reg); document.write(match); </script> </body> </html>
The above is the detailed content of Find non-space characters using JavaScript regular expression. For more information, please follow other related articles on the PHP Chinese website!