regex - Match a minimum number of concurrent lines in multiline regular expression -
i looking pattern allow me identify range of text in document consists of list of words. use text example.
property subject recipe newsletter news match reply bulletin joke annual greeting accepted puzzle march meeting din order alert printer thursday case chicago member a run of text appear in middle of html in spam email bodies. single word per line. words in english don't have worry uff-8 characters. these words meant confuse bayes filters, should easy match.
i'm looking way match several lines in row. simple regular expression match single line:
/^\w+$/ now, want able find minimum of 20 matching lines or more. how do that? this?
/^\w+${20,}/ any appreciated!
you close. need group expression inside parentheses quantifier apply whole expression, not preceding character. need put line break regexp well.
/(^\w+$\n){20,}/ depending on language you're using, may need add m (multi-line) modifier, ^ , $ match beginning , end of lines, not whole input string.
/(^\w+$\n){20,}/m
Comments
Post a Comment