i need match string has characteristics, think enabling /m
flag breaking functionality.
what know:
- the string start , end quotation marks.
- the string have following words. "the", "fox", , "lazy".
- the string may have line break in middle.
- the string never have @ sign (used in regex statement)
my problem is, if have string twice in single block of text, returns once, matching between first quote mark , last quote mark required words in-between.
here regex:
/^"the[^@]*fox[^@]*lazy[^@]*"$/gim
here understanding of statement. match string starts "the
, there word fox
, lazy
(in order) somewhere before string ends "
. ignore newlines , case-sensitivity.
the common answer limiting (.*?)
doesn't work new lines. , putting [^@?]*
doesn't work because adds ?
list of things ignore.
so how can keep "match until ___" skipping until last instance while still being able ignore newlines?
this not duplicate of else can find because deals multi-line matching, , don't.
in case, quantifiers need non-greedy can use flag ungreedy: u
.
/^"the[^@]*fox[^@]*lazy[^@]*"$/gimu
Comments
Post a Comment