Monday 5 December 2016

Chapter 6.0: Regular Expressions


1.1. Overview

A regular expression defines a search pattern for strings. Regular expressions can be used to search, edit and manipulate text. The pattern defined by the regular expression may match one or several times or not at all for a given string.
The abbreviation for regular expression is regex.
The process of analyzing or modifying a text with a regex is called: The regular expression is applied to the text (string) .
The pattern defined by the regex is applied on the text from left to right. Once a source character has been used in a match, it cannot be reused. For example, the regex aba will match ababababa only two times (aba_aba__).
A simple example for a regular expression is a (literal) string. For example, the Hello World regex will match the "Hello World" string.
. (dot) is another example for a regular expression. A dot matches any single character; it would match, for example, "a" or "z" or "1".

1.2. Support for regular expressions in programming languages

Regular expressions are supported by most programming languages, e.g., Java, Perl, Groovy, etc. Unfortunately each language supports regular expressions slightly different.

This tutorial describes the usage of regular expression within the Java programming language and within the Eclipse IDE.

No comments:

Post a Comment