R
R
romasovest2018-03-02 12:05:57
JavaScript
romasovest, 2018-03-02 12:05:57

How to get value from and to in multiline text?

`abcde`.match(/b.*d/); // bcd

`a
b
c
d
e`.match(/b.*d/); // null

What regular expression can be obtained in the second case "b↵c↵d"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nick Sdk, 2018-03-02
@romasovest

in general, in js, according to the manuals, they write that a flag (modifier) ​​"m" is needed for a multi-line search, but for some reason it only works for me with the "s" flag,
in general, try

`a
b
c
d
e`.match(/b.*d/s)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question