Connect with Facebook   
    Home  |   Learn AJAX  |   Forum  |    Register  |    Submit Resource  |   Submit Article   |   Contact Us
 

AJAX Tips

Home AJAX Tips

Pattern Matching in Regular Expressions

Category: AJAX Tips   |   Comments (0)

Regular expressions are all about matching the user’s input to the application requirements. Although the system could accept any data without regular expressions, it will not push through since it will never be authenticated. With smart usage of regular expressions, developers should be able build a highly interactive application that screens the data.


Sponsored Links
 

 


One of the key functions of regular expressions is pattern matching. As the name indicates, it’s a system within the application that determines if the input is according to the set pattern. When the pattern matching capabilities of a regular expression is set, then the data could flow through the function.


Pattern matching is divided into six types depending on the pattern set by the developers. Their functions are very different from each other so it’s very easy to determine which function should be used.


The following are the list of patterns:


• Repetition Matching
• Character Classes Matching
• Position Matching
• Alternation and Group Matching
• Back Reference Matching
• Special Literal Character Matching


The name of these types of matching can tell what they can do when integrated with the application. These matching could be used together if the developer wants stricter matching but it can create confusion in the application since it will have more than one requirement from the user.


Position and Literals

Aside from the classification of matching, there are also codes added in regular expressions that can determine how the data will be screened and what form of data is required from the user. Positions are small additions at the start of regular expression. They can tell the regular expression where the matching should start and should end.


The following are forms of position for regular expressions: ^, $, b, B. They can easily limit the position of the matching so that the rest of the code will be interpreted as another expression or a separate function.


Literals on the other hand will detail the actual look of the pattern matching class. Although the position of regular expressions could tell where to start and end, the position will not be able to inform the browser of the actual look of the regular expression. For that reason, literals are needed to properly form the regular expressions.


The combination of literals and position codes for regular expressions will ensure everything is in place. But there are additional commands wherein it could further delimit the data that could be placed by the user.


The following are the additional controls in regular expressions:


• Repetition
• Character Classes
• Back References
• Grouping and Alternates


Do take note that pattern matching is case sensitive. If this is not useful in your application, you could use “pattern switching” commands so that it will disregard the case sensitivity of the data and more forward with the function.



Sponsored Links
 

 

Patterns in regular expression could be a bit challenging to understand. But like most programming techniques, practice is highly required to make sure JavaScript and Ajax based applications will greatly improve with the help of regular expressions.



Read Next: Regular Expression Methods


 
Post Your Comment
Members - Please Click here Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification:
 
 Subscribe    

Post Your Comment via FaceBook

Connect with Facebook



 
Comments
 
 
 
 

Sponsored Links

 

Copyright © 2005 - 2010 AjaxWith.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape