Basic HTML version of Foils prepared 3 March 99

Foil 69 Grouping Patterns in Regular Expressions

From Overview of JavaScript I -- Basic Web Scripting Language CPS616 Technologies of the Information Age -- Spring Semester 99. by Geoffrey C. Fox (Tom Scavo)


Sequence is c1c2c3.. -- a sequence of single characters
* or {0,} is "zero or more" of previous character
+ or {1,} is "one or more" of previous character
? or {0,1} is "zero or one" of previous character
All matching is greedy -- they maximize number of characters "eaten up" starting with leftmost matching
Curly Brace Notation:
c{n1,n2} means from n1 to n2 instances of character c
c{n1,} means n1 or more instances of character c
c{n1} means exactly n1 instances of character c
c{0,n2} means n2 or less instances of character c



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Mar 3 1999