Javascript Regular Expressions: Count Leading Spaces [closed]
- by Jimmy
Possible Duplicate:
Count number of matches of a regex in Javascript
How can I count the number of Leading spaces in a string. In this case it would be 4:
var s = " Hello World";
// ^^^^ <-- 4 leading spaces