Regular Expression: Match Any Character in JavaScript

1. Match Any character not including newlines

. = any char
\. = the actual dot character
.? = .{0,1} = match any char zero or one times
.* = .{0,} = match any char zero or more times
.+ = .{1,} = match any char one or more times


2. Match Any character including newlines

[^]+ = match any char (means ‘don’t match no characters’, a double negative that can re-read as ‘match any character’);

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA