JavaScript
  Home arrow JavaScript arrow Page 11 - Understanding the JavaScript RegExp Ob...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
eWeek
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Understanding the JavaScript RegExp Object
By: Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 136
    2004-02-09

    Table of Contents:
  • Understanding the JavaScript RegExp Object
  • Enter the Matrix
  • Two to Tango
  • Game, Set, Match
  • Search and Destroy
  • In Splits
  • Objects in the Rear-View Mirror
  • One Mississippi, Two Mississippi...
  • Changing Things Around
  • Working with Forms
  • Over And Out

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    PCmover - $15 Off with Coupon Code CJPH7Q

    Understanding the JavaScript RegExp Object - Over And Out
    (Page 11 of 11 )

    After reading this tutorial, I'm pretty sure you're going to look at JavaScript in a different light. The language you just saw wasn't the one most commonly associated with image swaps and browser detection. Rather, it was a powerful tool to help you execute pattern-matching tasks in the client quickly and efficiently.

    I started off with a simple introduction to regular expressions and quickly moved to the search() and replace() methods of the JavaScript String object. These functions take a regular expression as parameter and allow you to carry out smart "search-and-replace" operations on string values. This was followed by an introduction to the hero behind the scenes: the core JavaScript Regexp object. This object comes with a host of methods and properties that allow ordinary programmers to leverage off the power of regular expressions in JavaScript.

    To close this article, I developed a simple example that demonstrates the use of complex regular expressions to validate form input - a routine task in all Web-based applications. If you do this often, it makes sense for you to build a good library of regular expressions for common validations (if you already have one, send me some mail and tell me all about it).

    Here are some additional URLs to help you understand the concept of regular expressions further:

    Stringing Things Along, at
    http://www.melonfire.com/community/columns/trog/article.php?id=173

    Pattern Matching and Regular Expressions, at
    http://www.webreference.com/js/column5/

    Regular Expressions for client-side JavaScript, a free online quick reference by VisiBone at http://www.visibone.com/regular-expressions/

    That's all for this article. See you soon!

    Note: Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

       

    JAVASCRIPT ARTICLES

    - Getting Attention with Interactive Effects
    - Interacting with Tooltips and Previews
    - Just-in-Time Information and Ajax
    - Interactive Effects
    - Using Cookies With JavaScript
    - Understanding the JavaScript RegExp Object
    - Controlling Browser Properties with JavaScri...
    - Using Timers in JavaScript
    - Form Validation with JavaScript
    - JavaScript Exception Handling
    - Stringing Things Along
    - Understanding The JavaScript Event Model (pa...
    - Understanding The JavaScript Event Model (pa...
    - An Object Lesson In JavaScript

    Iron Speed



    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway