Home arrow JavaScript arrow JavaScript String Regular Expressions
JAVASCRIPT

JavaScript String Regular Expressions


The regular expression object in JavaScript has the test() and exec() methods for regular expression problems. This object is called RegExp. The JavaScript String object has the match(), search(), replace() and split() methods for regular expression problems. The string object methods are actually better and easier to apply than the RegExp object methods. This two-part series takes a look at what you can do with them.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
September 24, 2009
TABLE OF CONTENTS:
  1. · JavaScript String Regular Expressions
  2. · Verification of Match Occurrence
  3. · Knowing Where Matching Occurs in the Available String
  4. · The String Search Method
  5. · Extracting Matches

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
JavaScript String Regular Expressions
(Page 1 of 5 )

Introduction

This article is for those who have basic knowledge of JavaScript Regular expressions. I wrote a series once on regular expressions in JavaScript. In this series I covered the important aspects of the regular expression object (RegExp). If you do not have any knowledge of JavaScript Regular Expressions, I advise you to read that series first. In this (present) two part series, I talk about JavaScript’s String methods  used for regular expressions. I give the advantages that these String methods have over the RegExp methods.

The features we shall talk about in this part of the series are verification of match occurrence, knowing where match occurs and extracting of matches.

Tutorial Approach

For each feature, I will first say whether you can solve the problem with the RegExp object. If it can be solved, then I will give you the RegExp object method. While we're working with the feature, I will go on to say if the problem can be solved with a String method. If it can be solved in that way, then I will give you the String method. If there is any advantage to using the String method over the RegExp method, I will tell you the advantage before we go to the next feature.

I call the string the pattern is matched against, the available string.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks
- Dynamic jQuery Styling

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials