R
R
ranftldieter2020-02-16 21:01:45
JavaScript
ranftldieter, 2020-02-16 21:01:45

What does the expression /some/ mean in JS?

I saw this in code examples for Node using the Telegram Bot API. The search is complicated by special characters, search engines do not understand, and I don’t know the specific name.
Example:

bot.onText(/echo (.+)/, (msg, match) => {
  bot.sendMessage(msg.chat.id, match[1]);
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2020-02-16
@ranftldieter

https://developer.mozilla.org/en/docs/Web/JavaScri...
https://regex101.com/r/n9FwIg/2/
/echo (.+)/
"echo" + whatever

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question