Answer the question
In order to leave comments, you need to log in
How to replace text in JS using regex?
Hello! There is a line like :qwerty1:qwerty2...
So - I need to replace the text between the colon and the ellipsis (inclusive) with an empty one. That is, remove the text. Apparently with the help of a regular expression .. As a result, you should get something like: qwety1
Answer the question
In order to leave comments, you need to log in
Much easier without regular expressions:
var str = ":qwerty1:qwerty2...",
divided = str.split(":");
divided.pop();
alert(divided.join(":"));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question