Regular Expressions

The following table outlines standard, supported regular expressions.

Label

Pattern

Single digit

\d

Two digits

\d{2}

Three digits

\d{3}

Four digits

\d{4}

Five digits

\d{5}

Number

[0-9]+ One or more

[0-9]* Zero or more

Decimal

.[0-9]+

Float

[0-9]+.[0-9]+

IP Address

(\d{1,3}.){3}\d{1,3}

IP Address/Mask

(\d{1,3}.){3}\d{1,3}/\d+

Domestic phone number with extension

1?[\s\-\/\.]*\(?([1-9]\d{2})\)?[\s\-\/\.]*([0-9]{3})[\s\-\/\.]*([09]{4})[\s\-\/\.x]*([0-9]{3,4})?

MAC Address

([0-9a-fA-F]{1,2}:){5}[0-9a-fA-F]{1,2}

MAC Address

([0-9a-fA-F]{1,2}.){5}[0-9a-fA-F]{1,2}

MIB2 OID

(1.3.6.1.6.1.2.1.(\d+\.)+\d)

Enterprise OID

(1.3.6.1.4.1.(\d+\.)+\d)

Time

[0-1][0-3]:[0-5][0-9]:[0-5][0-9]

All

.*

Ending Number

\d+$

Character

\w

Word

\w+ One or more.

\w* Zero or more.

Whitespace

\s+One or more.

\s* Zero or more.

String w/o space

\S+One or more.

\S* Zero or more.

New Line

\n

FormFeed

\f

Tab

\t

Carriage Return

\r

Backspace

\b

Escape

\e

Backslash

\B

URL

(?:^|")(http|ftp|mailto):(?://)?(\w+(?:[\.:@]\w+)*?)(?:/|@)([^"\?]*?)(?:\?([^\?"]*?))?(?:$|")

HTML Tag

<(\w+)[^>]*?>(.*?)</\1>

Here are some examples of such expressions:

Label

Pattern

Email address (U.S.)

^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$

MAC Address

([0-9a-fA-F]{1,2}:){5}[0-9a-fA-F]{1,2}

Time hh:mm:ss

(0[0-9]|1[0-2]):[0-5][0-9]:[0-5][0-9]

IP Address

(\d{1,3}.){3}\d{1,3}

Validated IP Address (restricts what matches better than the previous example)

(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9?])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9?])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9?])\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)

MIB2 OID

(1.2.6.1.6.1.2.1.(\d+\.)+\d

The following are examples of the kinds of matching possible:

Cutting and pasting from notepad into Open Manage Network Manager may cause carriage return or line-feed issues. Best practice is to compose these within Open Manage Network Manager.