The parentheses grouping operator works inside regular expressions much as you would expect it to. Everything inside the parentheses can be operated on by a repetition. This example matches the word java or javascript:
/java(script)?/
The grouping operator is also used to delimit sub-strings.
Prev | Home | Next |
RegExp pattern - extension syntax | Up | RegExp pattern - position |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |