Answer the question
In order to leave comments, you need to log in
How to get the value from a string?
There is a line:
Please tell me how to get only the number 16? var name = "Супер сериал 2018 (16 серий)";
Answer the question
In order to leave comments, you need to log in
To do this, you need to use regular expressions, in this case:
var name = "Супер сериал 2018 (16 серий)";
var new_name = name.replace(/^(.*?)\(([0-9]+)(.*)$/, '$2');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question