Like what
var v = "I want to ask a question 1098";
var v= "I'm 0 to ask questions"
var v= "I still want to ask 987"
Wait
I want 1098, 0, 987 inside.
There is definitely a set of numbers in a string, the number of which is not fixed, this group of numbers is composed of random 0~9, at least one, such as maybe only a 0.
With JS how to achieve.
<script>
var v = "I want to ask 1098";
S= ""
for (i=0;i<v.length;i++)
{
if ("0123456789". IndexOf (V.substr (i,1)) >-1)
s+=v.substr (i, 1
}
alert (s)
</script>
<script>
var str = "People's Republic of China 04314fdsa";
Alert (Str.replace (/^[^\d]* (\d+) [^\d]*$/, "$")];
</script>
<script language=javascript>
function getn (s)
{return s.replace (/[^0-9]/ig, " Alert (
getn ("I want to ask 1098")) Alert (
getn ("I want to ask you 0)") Alert
(GETN ("I want to ask 987"
)) </ script>
<script>
var v = "I still want to ask questions 987";
Alert (V.match (/\d+/ig));
</script>