Cisco Regex

Ez izgalmas téma. BGP AS_Path list-nél jött elő bővebben.

Ezek a regexek vannak:

http://www.cisco.com/en/US/docs/ios/12_2/termserv/configuration/guide/tcfaapre_ps1835_TSD_Products_Configuration_Guide_Chapter.html#wp1023226

 

Table 25 Cisco Regular Expression Characters

Regular Expression Character

Function

Examples
. Matches any single character. 0.0 matches 0x0 and 020t..t matches strings such as test, text, and tart
Matches the character following the backslash. Also matches (escapes) special characters. 172.1.. matches 172.1.10.10 but not 172.12.0.0. allows a period to be matched as a period
[ ] Matches the characters or a range of characters separated by a hyphen, within left and right square brackets. [02468a-z] matches 0, 4, and w, but not 1, 9, or K
^ Matches the character or null string at the beginning of an input string. ^123 matches 1234, but not 01234
? Matches zero or one occurrence of the pattern. (Precede the question mark with Ctrl-V sequence to prevent it from being interpreted as a help command.) ba?b matches bb and bab
$ Matches the character or null string at the end of an input string. 123$ matches 0123, but not 1234
* Matches zero or more sequences of the character preceding the asterisk. Also acts as a wildcard for matching any number of characters. 5* matches any occurrence of the number 5 including none18..* matches the characters 18. and any characters that follow 18.
+ Matches one or more sequences of the character preceding the plus sign. 8+ requires there to be at least one number 8 in the string to be matched
() [] Nest characters for matching. Separate endpoints of a range with a dash (-). (17)* matches any number of the two-character string 17([A-Za-z][0-9])+ matches one or more instances of letter-digit pairs: b8 and W4, as examples
| Concatenates constructs. Matches one of the characters or character patterns on either side of the vertical bar. A(B|C)D matches ABD and ACD, but not AD, ABCD, ABBD, or ACCD
_ Replaces a long regular expression list by matching a comma (,), left brace ({), right brace (}), the beginning of the input string, the end of the input string, or a space. The characters _1300_ can match any of the following strings:^1300$

^1300space

space1300

{1300,

,1300,

{1300}

,1300,

 

Feldobtam egy full egyszerű topológiát, hogy játsszak vele picit.

 

 

R2-n játszom.

 

Mutassa meg 2.2.2.2 ip-jű interface-t.

 

R2#show ip interface brief | include 2.2.2.2
Loopback1 2.2.2.2 YES manual up up

 

Mutassa a 22.22.22.22 IP című interface-t.

 

R2#show ip interface brief | include 22.22.22.22
Loopback2 22.22.22.22 YES manual up up

hostname-mel kezdődő sorok a running-configban:

 

R2#sh run | i ^hostname
hostname R2

 

Pontosan a 2.2.2.2 IP-jű interface:

 

R2#sh ip int brief | i _2.2.2.2_
Loopback1 2.2.2.2 YES manual up up

 

Pontosan a 2.2.2.2 interface

R2#sh ip int b | i _2.2.2.2_
Loopback1 2.2.2.2 YES manual up up

 

Csak Fa0/0 és Fa0/1 interface-k:

 

R2#sh ip int b | i _FastEthernet0/[0-1]
FastEthernet0/0 10.0.12.2 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down

 

Csak Fa0/0

R2#sh ip int b | i _FastEthernet0/[0]
FastEthernet0/0 10.0.12.2 YES manual up up

 

A kombinációk végtelenek, jó szórakozást!