I have a string "#Thisisa string (whichisneat!)"
I want from it the sub-strings "#This" and "a string".
The Regex /#(.*) is (.*)/ gives me this:
This is a string (which
neat!)
What I expected was this:
This
a string (which is neat!)
Why is it matching the second is in the regex and how to get the output I actually expected which is by matching the first is?
var string = "#This is a string (which is neat!)"
var match = string.match(/#(.*) is (.*)/);
alert('1st match: \t' + match[1] + '\n2nd match: \t' + match[2]);