Regular expression, new RegExp - Javascript

Regular expressions are a powerful tool for performing pattern matches in Strings in JavaScript.

127.0.0.1
1.2.3.4
192.168.1.100

Javascript code

var ipRE = new RegExp( '^d+.d+.d+.d$' );

i, – “ignore case” – the case (uppercase/lowercase) of all letters within the string will be ignored during testing.
g, – “global search” – the search is carried out across the entire string, regardless of whether a match has already been found.
m, – “multiline search” – the regular expression will match over multiple lines.

^ - This symbol matches the beginning of the string.
d - This meta-character matches a single digit (i.e., 0 to 9).
+ - This symbol says to repeat the preceding pattern or symbol 1 or more times (i.e., 1 or more digits).
. - This sequence is needed to match a period.  Since a period has special meaning in a RegExp, we have to precede it with the backslash to indicate that we don't want the special meaning, we really want to match a period.
$ - This symbol matches the end of the string.