Cisco

Submitted by: Submitted by

Views: 178

Words: 4287

Pages: 18

Category: Other Topics

Date Submitted: 06/13/2013 07:25 AM

Report This Essay

REVIEW DRAFT—CISCO CONFIDENTIAL

Regular Expressions

First Published: February 4, 2004 Last Updated: April 15, 2011

This appendix explains regular expressions and how to use them in Cisco IOS software commands. It also provides details for composing regular expressions.

Contents

• • • • • • • • •

Information About Regular Expressions, page 1 Cisco Regular Expression Pattern Matching Characters, page 2 Single-Character Patterns, page 3 Multiple-Character Patterns, page 4 Multipliers, page 4 Alternation, page 5 Anchoring, page 5 Parentheses for Recall, page 5 Examples of Regular Expressions, page 6

Information About Regular Expressions

Regular expressions are strings of special characters that can be used to search and find character patterns. A regular expression is entered as part of a command, and it is a pattern made up of symbols, letters, and numbers that represent an input string. Matching the string to the specified pattern is called pattern matching. Pattern matching either succeeds or fails. If a regular expression can match two different parts of an input string, it will match the earliest part first. Cisco configurations use regular expression pattern matching in several implementations. The following is a list of some of these implementations:

Americas Headquarters: Cisco Systems, Inc., 170 West Tasman Drive, San Jose, CA 95134-1706 USA

Regular Expressions Cisco Regular Expression Pattern Matching Characters

REVIEW DRAFT—CISCO CONFIDENTIAL

• • • •

Border Gateway Protocol (BGP)IP autonomous system path and X.29 access lists Modem (or chat) and system scripts X.25 route substitute destination feature Protocol translation ruleset scripts

Cisco Regular Expression Pattern Matching Characters

Table 1 summarizes the basic Cisco IOS regular expression characters and their functions.

Table 1 Cisco Regular Expression Characters

Regular Expression Character Function . Matches any single character.

Examples 0.0 matches 0x0...