Java Games: Flashcards, matching, concentration, and word search.

Regular Expressions 1: Vocabulary

Terms used to describe regular expressions,
and the basic buiding blocks.
Ref.: Mastering Regular Expressions. Jeffrey E. F. Friedl, O'Reilly 1997
Also try Regular Expressions 2: Exercises
(http://www.quia.com/mc/71732.html)
Convention: "..." is not part of a regex, but meant to indicate the presence of some item (subexpression).

AB
"Regular Expression" (abbreviated)regex
metacharactercharacter not taken literally
literalnormal text character
anchormetacharacter matching a position
[... ] character classmatches any one of several characters
dash (-) between 2 chars in character classindicates range of chars
[^...] negated character classmatches any char not listed
dot (.)matches any character
or, bar (|)separates alternative subexpressions
parentheses (...)create subexpression (grouping)
quantifiers (?, +, *)indicate number of occurences of previous item
...? (question mark)zero or one occurences of previous item
...* (star, asterisk)zero or more occurences of previous item
...+ (plus)at least one occurence of previous item
described by a regexa set of strings satisfying certain constraints
^...begin of line (anchor)
...$end of line (anchor)
\w (small caps)part-of-word char [a-zA-Z0-9_]
\W (capital)non-word char [^w]
\d (small caps)digit [0-9]
\D (capital)non digit [^0-9]
\s (small caps)whitespace character [ \f\n\r\t\v]
\S (capital)non-whitespace character [^\s]
escapingneutralizing a metacharacter (reducing it to text)
\char (if combination is not metadescriptive)escaped char
\ttab character
\rreturn character
\nnewline character
...{min,max}repeat previous at least min times, but not more than max times
...{min,} (comma!)repeat previous item at least min times
...{num} (no comma)repeat previous item num times
groupingputting part of a regex between parentheses (creates a subexpression)


Henk

This activity was created by a Quia Web subscriber.
Learn more about Quia
Create your own activities