O
O
olezhenka2018-07-12 19:50:38
JavaScript
olezhenka, 2018-07-12 19:50:38

How can I make a regular expression remember an optional match?

'a https://vk.com a'.match(/(http(s)?:\/\/.)?vk\.com/g) // нашел vk.com, а я хочу чтобы https тоже нашел

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2018-07-12
@olezhenka

You have an extra point.

'a https://vk.com a'.match(/(http(s)?:\/\/)?vk\.com/g)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question