Limitations of Regular Expressions

Regular Expressions can provide a useful way to ensure that entered data confirms to a predefined format or to replace one pattern with another. However, they have some limitations as described below :

Getting a positive match only proves that the sample matches the defined format, it does not mean that the value is a 'correct' one.

Replace will follow the GIGO principle - Garbage In Garbage Out - so be careful when creating your Regular Expressions as may cause more problems then you solve. For example, the Regular Expression /win/i can provide some odd results when used as a Replace Expression with lose on the following :

This is the Regular Expression that is going to win me the prize from my twin, although we have to be careful not to break any windows of the house nextdoor

The result would be :

This is the Regular Expression that is going to lose me the prize from my tlose, although we have to be careful not to break any losedows of the house nextdoor

As you can see we needed to be a little more precise with the Regular Expression.

Now that we have explored Regular Expressions, lets have a look at how you can use them in client side scripting using Javascript.

Website Designed by Adservio Consulting Valid HTML 4.01 Strict    Valid CSS!    Level A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0