CISCO
  • CISCO CERTIFICATIONS
  • CISCO DevNet - Coding & API's
    • Untitled
  • CCNA
    • Networking Fundamentals
    • Introduction
    • OSI, TCP/IP and 5 Layer Model
    • Binary
    • Hexadecimal
    • Cabling and Packet Flows
    • IP v4 Addressing
      • VLSM
    • Cisco IOS Software
    • Wireshark Basics
    • Switches
      • VLANS
        • DTP/VTP (Cisco Proprietary)
        • STP - Classic
        • STP - RSTP
      • EtherChannel
    • Routing
      • Dynamic Routing
      • RIP and EIGRP
      • OSPF 1 - Basics
      • OSPF 2 - Cost, Neighbours and Configs
      • OSPF 3 - Network and LSA Types
      • FHRP
        • HSRP
        • VRRP
      • IP SLA
      • BGP
        • Regular Expressions
    • Programming
  • CCNP
    • SetUp Stuff
    • CCNP ENCOR 350-401
      • Packet Forwarding:
  • IP Address Managers
    • Opensource
  • CCNA LABS
  • CCNA LABS
Powered by GitBook
On this page
  • Resources
  • Introduction
  • What is RegEx

Was this helpful?

  1. CCNA
  2. Routing
  3. BGP

Regular Expressions

Asterisk on STEROIDS !!

PreviousBGPNextProgramming

Last updated 4 years ago

Was this helpful?

Resources

Introduction

This introduction will enable us to do the following:

  • Describe Regular Expressions

  • Use regular expressions to match basic patterns

  • Describe RegEx Metacharacter

  • Practise Regular Expressions using or

METACHARACTER

METACHARACTER NAME

MEANING

1

^

caret

Matches the beginning of the string, or the beginning of a line if the multiline flag (m) is enabled. This matches a position, not a character.

2

$

dollar sign

Denotes the END of a regular expression or ending of a line

3

[ ]

square bracket

Specifies a range of characters you wish to match

4

( )

parenthesis

Check for a string. Create and store variables

5

?

question mark

Check for zero or one occurrence of the preceding character .... zero or one instance

6

+

plus sign

Check for one or more occurrence of the preceding character .....one or more instances

7

*

multiply sign

check for any number of occurrences (including zero occurrence) of the preceding character ... zero or more instances

8

.

dot

check for a single character which is not the ending of a line......Any single character

9

|

pipe

Logical OR

10

\

escaping character

Escape from the normal way a subsequent character is interpreted

11

!

exclamation mark

Logical NOT

12

{ }

curly brackets

Repeat preceding character

13

-

dash

Used to specify range ie [0-9]

The fat cat ran down the street.
It was seraching for a mouse to eat.

What is RegEx

RegEx is the shortened word for Regular Expression. A regular expression is a way of searching through text files - such as logfiles etc. in an efficient and painless way as possible. We can also do advanced 'find and replace.

^a . . .s$

The caret means "at the beginning

Using the websites above (eg ) in the text field we have written some text to be searched by regex with the global and multiline selected. I will remove the multi-line option to keep it as close to normal regex as possible.

https://regex101.com
https://regexr.com
https://regexr.com