Answer the question
In order to leave comments, you need to log in
How to find numbers in url using javascript?
There is a page: Razdel1page01.html
How to use javascript to find out what two numbers come before .html?
Answer the question
In order to leave comments, you need to log in
Regular Expressions
var str = "Razdel1page01.html";
var result = str.match(/([0-9]{2})(\.html)/ );
alert(result[1]);
var str = 'Razdel1page02.html',
digits = str.match(/\d/g),
result = digits.slice(digits.length-2);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question