This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

REX EXPRESSION for VLAN range

How i can mention the VLAN range in REX ??? Below one is not working some one help me

^interface FastEthernet.*\n(.*\n)*.*switchport access vlan [128 -300].*\n(.*\n)*.*

  • That should do it: ^interface FastEthernet.+\nswitchport access vlan ((?![1][2][0-7])[1-2][2-9][0-9]|[2][0-9][0-9]|[3][0][0])

    ((?![1][2][0-7])

    takes care of everything equal or below 127

    [1-2][2-9][0-9]|

    takes care of everything from 120 to 299 (120 to 127 is taken care of by the first negative lookahead)

    |[2][0-9][0-9]|

    takes care of everything from 201 to 299

    |[3][0][0])

    takes care of  300

    Regards

    Rene

  • While using Below REX it not checking 128 to 300 VLAN but checking all

    ^interface FastEthernet.*\n(.*\n)*.*switchport access vlan [128 -300].*\n(.*\n)*.*

    pastedImage_2.png

    In the below REX it not checking the correct interface (which i have verified manually and updated in NCM configs)

    ^interface FastEthernet.+\nswitchport access vlan ((?![1][2][0-7])[1-2][2-9][0-9]|[2][0-9][0-9]|[3][0][0])

    pastedImage_0.png

    pastedImage_1.png

    pastedImage_3.png

    Where am doing mistake ???

  • Sorry for the delay, the whitespaces in front of "Switchport" are the issue.

    This should do it: ^interface FastEthernet.+\n(\s*)switchport access vlan ((?![1][2][0-7])[1-2][2-9][0-9]|[2][0-9][0-9]|[3][0][0])

    Regards

    Rene