I have content in a meta tag.
<meta property="video" content="initialver=1.0" />
I get the content in this tag using getAttribute("content")
. Then I have a string: initialver=1.0
. My need is getting "1.0". How can I do this without using split()
?
I have content in a meta tag.
<meta property="video" content="initialver=1.0" />
I get the content in this tag using getAttribute("content")
. Then I have a string: initialver=1.0
. My need is getting "1.0". How can I do this without using split()
?
2 Answers
Reset to default 1var str = "initialver=1.0";
var result = str.substring(11);
You can use regex and match to do this
var x = "initialver=1.0".match(/\d+$|\d+\.\d+$/)[0]