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

Regular Expressions 1: Vocabulary

Find the meaning of metacharacters and regex related terms.

- Vikram Vaswani and Harish Kamath:
- Mastering Regular Expressions. Jeffrey E. F. Friedl, O'Reilly 1997
(Ch.4: )

Apply your conceptual knowledge in:
Regular Expressions 2: Exercises ( )

About the notation used: "..." is not part of a regex, but meant to indicate the presence of some item (subexpression).

"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 (lower case)part-of-word char [a-zA-Z0-9_]
\W (capital)non-word char [^w]
\d (lower case)digit [0-9]
\D (capital)non digit [^0-9]
\s (lower case)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)
\ followed by a digitback reference to the digith subexpression (between parentheses)


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