• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Part VIII: Appendixes > Pattern Matching the Regular Expression Way

Pattern Matching the Regular Expression Way

The check_mask() function works fine in its own way, but it takes a lot of work—the function and its calling statement comprise some 20 statements—to solve what seems like a very basic validation problem.

So you might be interested to know that JavaScript 1.2 offers an alternative way to check a string against a mask. This alternate method is not only more powerful than the check_mask() function, but it's far more compact. In fact, you can use this method to do some very powerful things with a grand total of just one or two statements! If that sounds amazing, then welcome to the amazing and often strange world of regular expressions.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint