W
W
webhero2020-05-17 08:26:22
JavaScript
webhero, 2020-05-17 08:26:22

How to truncate certain characters with regex?

There is a line: http://google.ru/.
You need to trim at http://the /end.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-05-17
@webhero

str.replace(/^https?:\/\/|\/$/g, '')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question