js regex \s+ meaning
JavaScript[Edit]
+
0
-
0
js regex \s+ meaning
1 2 3 4 5 6 7 8 9 10// \s+ matches whitespace characters (multiple characters such as spaces, tabs, line breaks) const text = '1. Example text...'; const regex = /\s+/g; const result = text.match(regex); if (result) { console.log(result); // [' ',' '] }
[Edit]
+
0
-
0
js regex \S+ meaning
1 2 3 4 5 6 7 8 9 10 11// '\S+' matches any non-whitespace characters // multiple characters that are not: spaces, tabs, line breaks const text = 'Example text\n ...'; const regex = /\S+/g; const result = text.match(regex); if (result) { console.log(result); // ['Example','text','...'] }