Regular expression for validating numbers in javascript

6854933580_2c8b688306_z

Run In Java Script, there are actually two ways to create a regular expressions: using a regular expression literal, which we have discussed before and using a Reg Exp() constructor.

When searching in a given string, you can specify the pattern you're looking for.

Note that the g is a global modifier which means find all matches and don't stop after the first match is found.

Run The method split() splits a string into an array of strings based on the regular expression.

In the example below we see that this adds considerable complexity to the pattern, which is why they are not recommended.

Run The test() method on Reg Exp checks whether the string argument contains a match of the pattern specified by the regular expression.

Hi, In one textbox , I need to allow Letters, swedish letters, numbers and special chars ( / , -, _ ) and space.

You must have an account to comment. Please register or login here!