This will get all the numbers separated by coma:
<script>
$(document).ready(function(){
If You are just looking for thew first occurrence, the pattern will be
(There is no need for JQuery)
<script>
$(document).ready(function(){
var str = "10 is smaller than 11 but greater then 9";
var pattern = /[0-9]+/g;
var matches = str.match(pattern);
});
</script>
After execution, the string matches
will have values "10,11,9"
If You are just looking for thew first occurrence, the pattern will be
/[0-9]+/
- which will return 10
(There is no need for JQuery)
0 comments:
Post a Comment