cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
7264
Views
20
Helpful
7
Replies

Cisco 9800 AP Filter REGEX

Skjoedt
Level 1
Level 1

Hello

I have a customer who has decided to use a location prefix and a function suffix for AP naming on their Cisco 9800.

For example:
EU-Site2-AP20-Root

EU-Site2-AP21-MAP


I am now trying to create AP-filters for this and i want to match on:
"Site2" and "Root" in AP filter rule 1
"Site2" and "MAP" in AP filter rule 2

I am not skilled at all in REGEX, so i can only do the basics like ^ for matching the beginning of a string, $ for matching the end of a string, | for matching one or the other etc.

 

Basically, can someone help me create a one-liner REGEX with an "AND" operator, that will work in 9800?
"?" as a character is not allowed for REGEX in the 9800... Not in the GUI at least...

Best Regards
Frederik

1 Accepted Solution

Accepted Solutions

Try this one then
((Site2).*(Root))

 

Replace the Site2 and Root with the site and mesh type

*****Help out other by using the rating system and marking answered questions as "Answered"*****
*** Please rate helpful posts ***

View solution in original post

7 Replies 7

Try this:

^(?=.*\bSite2\b)(?=.*\bRoot\b).*$

 

Replace Site2 and Root with the 2 variables you wish to match

 

The expressions in parentheses starting with ?= are the positive lookaheads. I'll break down the pattern:

  1. ^ asserts the start of the expression to be matched.
  2. (?=.*\bSite2\b) is the first positive lookahead saying that what follows must match .*\bSite2\b.
  3. .* means any character zero or more times.
  4. \b means any word boundary (white space, start of expression, end of expression, etc.).
  5. Site2 is literally those four characters in a row (the same for Root in the next positive lookahead).
  6. $ asserts the end of the expression to me matched.

 

Useful Regex tester here https://regex101.com/ 

*****Help out other by using the rating system and marking answered questions as "Answered"*****
*** Please rate helpful posts ***

Hello Haydn

Thank you for your reply!

Have you had the possibility to try out that REGEX on a Cisco 9800 WLC?

I have tried using "?" as a character in my REGEX, but the Cisco 9800 WLC will not accept "?" as a character, because ? is used in the syntax for CLI to look up command possibilities like "Show ip ?" to look up the possible keywords to use after "Show ip"...
- So if you try and use ? in your REGEX, you will get an error like the on the attached screenshot...

Do you know if there is another way of doing it, that doesn't involve "?" as a character?

Best Regards
Frederik

Try this one then
((Site2).*(Root))

 

Replace the Site2 and Root with the site and mesh type

*****Help out other by using the rating system and marking answered questions as "Answered"*****
*** Please rate helpful posts ***

Hello Haydn

Again, thank you for your reply!

The 9800 seems to be OK with that REGEX one-liner!
I will try it out once I am back at the customer site and able to test

Best Regards
Frederik

Hello Haydn

I have now had the chance to test out the above mentioned REGEX one-liner in the customer environment...
- And it works!

So now i have successfully configured all the RAP's and MAP's using separate rules from the rules configuring the AP's inside the building and all AP's are getting the correct tags!

Thank you very much for your help!

Best Regards
Frederik

Rich R
VIP
VIP

What version of code?  Have you tried 17.6.3? (not that I know of any specific fix but lots of general improvements)

Also try using the original in quotes ""

Try configuring on CLI? (again also using quotes)

Also note there's an enhancement (feature request) bug raised https://bst.cloudapps.cisco.com/bugsearch/bug/CSCvz84973

 

Hello rrudling

 

Unfortunately i cannot upgrade past 17.3.x, since the customer still has some 2702 AP's which has to be taken into consideration.

I have not tried to configure the REGEX using CLI or ""

That feature request you have highlighted seems to be wanting to do the almost the same as i am trying to do
- Thanks! I will keep an eye out for this feature request to see if it gets a solution.

I will get back about the REGEX once i have had time at the customer during the week.

Best Regards
Frederik

Review Cisco Networking for a $25 gift card