T
T
tundramani2020-05-06 19:03:42
JavaScript
tundramani, 2020-05-06 19:03:42

How to replace multiple slashes with one?

We need a regular expression that replaces any number of slashes in a string with one

var строка2 = строка1.replace('//' , '/')  //аналог этого но для множественных слешей

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-05-06
@tundramani

string.replace(/\/+/g, '/');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question