APPLICATION OF
REGULAR EXPRESSION
KAVANA K A
1DB20CS056
REGULAR EXPRESSION
● ε is a Regular Expression indicates the language containing an empty string. (L (ε) = {ε})
● φ is a Regular Expression denoting an empty language. (L (φ) = { })
● x is a Regular Expression where L = {x}
● If X is a Regular Expression denoting the language L(X) and Y is a Regular Expression
denoting the language L(Y), then
○ X + Y is a Regular Expression corresponding to the language L(X) ∪ L(Y) where
L(X+Y) = L(X) ∪ L(Y).
○ X . Y is a Regular Expression corresponding to the language L(X) . L(Y) where L(X.Y)
= L(X) . L(Y)
○ R* is a Regular Expression corresponding to the language L(R*)where L(R*) = (L(R))*
APPLICATION OF REGULAR EXPRESSION
Lexical analyzer is the component of a compiler that breaks
the source program into logical units (called tokens) of one
or more characters that have a shared significance.
Examples of tokens include keywords (e.g., while),identifiers
(e.g., any letter followed by zero or more letters and/or
digits),and Sig,TIS,such as + or <=. A lexical-analyzer
generator accepts descriptions of the forms of tokens, which
are essentially regular expressions, and produces a DFA that
recognizes which token appears next on the input.
Pattern matching refers to a set of objects with some common properties we
can match an identifier or a decimal number or we can search for a string in
the text
Regular expressions are useful in a wide variety of text processing tasks, and
more generally string processing, where the data need not be textual.
Common applications include data validation, data scraping (especially web
scraping), data wrangling, simple parsing, the production of syntax
highlighting systems, and many other tasks.
While regexps would be useful on Internet search engines, processing them
across the entire database could consume excessive computer resources
depending on the complexity and design of the regex.
Regular expressions can be matched against the subject fields defined in emails
to find some spams
The programming language Perl supports regular expressions matching
Meaning words in protein sequences are called motifs. The motifs can be
described using regular expressions
In XML , the regular expressions are one way to define parts of new document
types.
REGULAR EXPRESSION IN UNIX:
Regular expressions are extensively used in Unix operating system. But certain
short notations are used in UNIX platform using which complex regular
expressions are avoided. For example , the symbol ‘.’ stands for any
character , the sequence [ a b c d e….] stands for the regular expression
“a + b+ c+ d+ e………”,the operator | is used in place of +,the operator ?
means “zero or one of” etc . most of the commands are invoked invariably
uses regular expressions .For example , grep (global search for regular
expression and print) used to search for a pattern of string