Skip to main content
added 46 characters in body
Source Link

What regex will match:

contains at least one instance of "1221", and no instances of "7474"

i.e. matches "7777 1221 4543"

but does not match "7777 1221 7474 4543"

I suspect I have to use negative lookaheads?

I am using Cisco IOS (version: IOS XE 3.10.4S)

What regex will match:

contains at least one instance of "1221", and no instances of "7474"

i.e. matches "7777 1221 4543"

but does not match "7777 1221 7474 4543"

I suspect I have to use negative lookaheads?

What regex will match:

contains at least one instance of "1221", and no instances of "7474"

i.e. matches "7777 1221 4543"

but does not match "7777 1221 7474 4543"

I suspect I have to use negative lookaheads?

I am using Cisco IOS (version: IOS XE 3.10.4S)

edited tags
Link
Gilles 'SO- stop being evil'
  • 865.5k
  • 205
  • 1.8k
  • 2.3k
Source Link

Regex for contains at least one instance of STRINGA and no instances of STRINGB

What regex will match:

contains at least one instance of "1221", and no instances of "7474"

i.e. matches "7777 1221 4543"

but does not match "7777 1221 7474 4543"

I suspect I have to use negative lookaheads?