Reputation:
I'm using the following regular expression to match everything:
/^(?=.{10,8000}$).*$/
But now I just realize that .*
doesn't match the newline character. How can I make this regular expression match newlines?
Upvotes: 5
Views: 11342
Reputation: 155
I think that is pretty much simpler, just use
/.*/
. stands for any character and * allows any repetition of that character.
Upvotes: 2
Reputation: 3082
var filter = /.*/gim;
That will match everything across multiple lines.
Upvotes: 1
Reputation: 26940
Why do you use a regex?
var txt = "Hello World!";
if(length(txt) >= 10 && length(txt) <= 8000) {//match}
Upvotes: 0
Reputation: 349232
All whitespace + non-whitespace = all characters: [\S\s]
/^(?=[\S\s]{10,8000})[\S\s]*$/
Upvotes: 8