Quick reference on regular expressions – Konica Minolta Digital StoreFront User Manual

Page 124

Advertising
background image

Digital StoreFront 5.2 Administration Reference

124

Quick Reference on Regular Expressions

Overview of Unit System and Phone Number Formats

Regular expressions provide an efficient way of searching for patterns in text or validating user-supplied
text data. Regular expressions occur frequently in the code within Digital StoreFront, but Digital
StoreFront now requests these from administrator from the Accounting Code interface (when using
patterns) to confirm that the buyer-supplied values match an expected format (see

To enable

accounting codes

).

This appendix will illustrate what regular expressions can do through several examples. Online
resources and small handbooks may be the best sources of information about how to set up specific
expressions.

Digital StoreFront uses regular expressions based on .NET. Other implementations (e.g., Unix,

Javascript, etc.) provide similar functionality, but some details differ. So double-check the regular
expressions you use.

Regular Expression Syntax

Regular expressions are all about how to describe a character pattern uniquely and in such a way that a
computer can validate the pattern. You can use a number of escaped characters to denote certain keys,
for instance \t means a tab. The table below lists a number of escaped characters.

Escaped Character

Description

Ordinary characters

Characters other than . $ ^ { [ ( > ) * + ? \ match themselves.

\b

\b denotes a word boundary (between \w and \W characters) except
within a [] character class, where \b refers to the backspace character.
See the table below.

\t

Matches a tab.

\r

Matches a carriage return.

\v

Matches a vertical tab.

\f

Matches a form feed.

\n

Matches a new line.

\e

Matches an escape.

\

\ When followed by a character that is not recognized as an escaped
character, matches that character. For example, \* is the same as \x2A.

A character class is a set of characters that will find a match if any one of the characters included in the
set matches. The following table summarizes character matching syntax.

Advertising