Z
Z
zxfer2018-03-09 17:55:16
JavaScript
zxfer, 2018-03-09 17:55:16

How to get multiline contents of RegExp?

There is a regular expression RegExp('(.*?)<' + '/tag>', 'gim').
Returns only if there is one line inside tag. If there is a carry at the beginning or at the end, then there is no match. Is it possible to apply the "m" flag to the search content?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Shamanov, 2018-03-09
@SilenceOfWinter

should be something like
RegExp('<tag>(.+?)</tag>', 'gim')

B
Boris Korobkov, 2018-03-09
@BorisKorobkov

<tag>([.\n]+?)</tag>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question