Creating Regular Expressions


In JavaScript, regular expressions are expressions enclosed between forward slashes (/), such as the ones we've already seen (for instance, /\b[^A-Z]+\b/ ); they also can be followed by modifier characters outside the last slash (for instance, /\b[^A-Z]+\b/g , which uses the g modifier to make a search global). In general, such regular expressions can be made up of these parts :

  • Characters

  • Character classes

  • Alternative match patterns

  • Quantifiers

  • Assertions

  • Backreferences

  • Regular expression extensions

The following sections discuss all of these parts. Note that regular expressions can get very complex very quickly, and that they're very, very compact. They'll often take some patience to work with until you become an expert. I'll start by taking a look at characters in regular expressions.



Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net