Skip to main content Accessibility help
×
Hostname: page-component-77c89778f8-vpsfw Total loading time: 0 Render date: 2024-07-23T07:20:23.263Z Has data issue: false hasContentIssue false

5 - Regular expression matching

Published online by Cambridge University Press:  18 December 2014

Gonzalo Navarro
Affiliation:
Universidad de Chile
Mathieu Raffinot
Affiliation:
Centre National de la Recherche Scientifique (CNRS), Paris
Get access

Summary

Basic concepts

We present in this chapter algorithms to search for regular expressions in texts or biological sequences. Regular expressions are often used in text retrieval or computational biology applications to represent search patterns that are more complex than a string, a set of strings, or an extended string. We begin with a formal definition of a regular expression and the language (set of strings) it represents.

DefinitionA regular expression RE is a string on the set of symbols Σ ∪ { ε, |, ·, ⋆, (,) }, which is recursively defined as the empty character ε a character α ∈ Σ and (RE1), (RE1 · RE2), (RE1 | RE2), and (RE1⋆), where RE1and RE2are regular expressions.

For instance, in this chapter we consider the regular expression (((A·T) | (G·A))·(((A·G) | ((A·A)·A))⋆)). When there is no ambiguity, we simplify our expressions by writing RE1RE2 instead of (RE1 · RE2). This way, we obtain a more readable expression, in our case (AT|GA) ((AG|AAA)⋆). It is usual to use also the precedence order “*”, “·”, “|” to remove more parentheses, but we do not do this here. The symbols “·”, “|”, “⋆” are called operators. It is customary to add an extra postfix operator “+” to mean RE+ = RE · RE⋆. We define now the language represented by a regular expression.

DefinitionThe language represented by a regular expression RE is a set of strings over Σ which is defined recursively on the structure of RE as follows:

  1. If RE is ε, then L(RE) = {ε}, the empty string.

  2. If RE is α ∈ Σ, then L(RE) = {α}, a single string of one character.

  3. If RE is of the form (RE1), then L(RE) = L(RE1).

  4. If RE is of the form (RE1 · RE2), then L(RE) = L(RE1) · L(RE2), where W1 · W2is the set of strings w such that w = w1w2, with w1W1and w2W2. The operator “·” represents the classical concatenation of strings.

  5. […]

Type
Chapter
Information
Flexible Pattern Matching in Strings
Practical On-Line Search Algorithms for Texts and Biological Sequences
, pp. 99 - 144
Publisher: Cambridge University Press
Print publication year: 2002

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×