Published online by Cambridge University Press: 18 December 2014
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:
• If RE is ε, then L(RE) = {ε}, the empty string.
• If RE is α ∈ Σ, then L(RE) = {α}, a single string of one character.
• If RE is of the form (RE1), then L(RE) = L(RE1).
• 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 w1 ∈ W1and w2 ∈ W2. The operator “·” represents the classical concatenation of strings.
[…]
To save this book to your Kindle, first ensure [email protected] 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.
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.
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.