Asn1Browser v4.4
Regular expressions
Contents
Introduction
This is a short overview of regular expressions used to define file filters
in profile files of
Asn1Browser.
A regular expression consists of a character string where some characters
are given special meaning with regard to pattern matching. Regular expressions
have been in use from the early days of computing, and provide a powerful and
efficient way to parse, interpret and search and replace text within an application.
Syntax
Within a regular expression, the following characters have special meaning.
Positional Operators
- ^ matches at the beginning of a line.
- $ matches at the end of a line.
- \A matches the start of the entire string.
- \Z matches the end of the entire string.
One-Character Operators
- . matches any single character.
- \d matches any decimal digit.
- \D matches any non-digit.
- \n matches a newline character.
- \r matches a return character.
- \s matches any whitespace character.
- \S matches any non-whitespace character.
- \t matches a horizontal tab character.
- \w matches any word (alphanumeric) character.
- \W matches any non-word (alphanumeric) character.
- \x matches the character x, if x is not one of the above
listed escape sequences.
Character Class Operator
- [abc] matches any character in the set a, b or c.
- [^abc] matches any character not in the set a, b or c.
- [a-z] matches any character in the range a to z, inclusive.
- A leading or trailing dash will be interpreted literally.
Subexpressions and Backreferences
(abc)matches whatever the expression abc would match,
and saves it as a subexpression. Also used for grouping.
-
(?:...) pure grouping operator, does not save contents.
-
(?#...) embedded comment, ignored by engine.
-
\n where 0 < n < 10, matches the same
thing the nth subexpression matched.
Branching (Alternation) Operator
- a|b matches whatever the expression a would match, or whatever the
expression b would match.
Repeating Operators
These symbols operate on the previous atomic expression :
- ? matches the preceding expression or the null string.
- * matches the null string or any number of repetitions of the preceding
expression.
- + matches one or more repetitions of the preceding expression.
- {m} matches exactly m repetitions of the one-character expression.
- {m,n} matches between m and n repetitions of the preceding
expression, inclusive.
- {m, } matches m or more repetitions of the preceding expression.
Reference Material
We have used the package gnu.regexp - Regular Expressions for Java - to implement
this function. You can refer to the site gnu.regexp
to get more information about the regular expressions.
Asn1Compiler, Asn1Browser, Asn1API are developed and licensed by uniGone. They are members of uniGone Asn1Solutions software.
For further information, email to unigone@unigone.com.
Copyright © uniGone 1999-2011. All Rights Reserved.
uniGone 4 Route de la Noue 91190 GIF SUR YVETTE France.