The regular Expression two intrinsic objects associated with program.
The RegExp object and
The Regular Expression object.
The RegExp object is the parent in regular expression object. RegExp has a constructor function that is instantiates of the Regular Expression object much like the Date object instantiates an new date.
|Var RegularExpression = new RegExp("pattern", ["switch"])|
for Regular Expression objects. There are implicitly calls the RegExp constructor function. The syntax
for the follows:
var RegularExpression = /pattern/[switch]
var x = "my program's contents";
var y = x.indexOf("my");
the indexOf() to look for all the characters you didn't want to find. If an illegal character is found, an alert box could be flashed asking the user to re-enter their information. The
isReady() function using the on Submit event handler, the information is validated before being sent to the server.
validation function is the returns true, the ACTION attribute of the form is run.
The first is to specify it by hand using normal syntax, and
The second is to use the new RegExp() constructor
pattern = /:+/;
pattern = new RegExp(":+");
that takes two arguments, one being the regular expression if you want to searched for, and the other being the replacement text you want substituted.
Liked it! Share this Tutorial