|
Rank: Newbie
Posts: 3
|
Folks, I am trying to make this extension do something which should be simple. I want to specify a search string that will match:
nameif ethernet1 OR nameif ethernet2 OR nameif ethernet3 ... you get the picture.
I have tried string like the following, to no avail: nameif ethernet. nameif ethernet(0-9) nameif ethernet*
Can someone help?
Also, how could I except anything in the middle of a string?
For example, I'd like to be able to match on: aaa-server ACS (inside) host 9.9.9.9 $variable@username@encryptedvalue timeout 5
So really, as long as I see the following in my check, I'd be happy: aaa-server ACS (inside) host 9.9.9.9 timeout 5
Can anyone help?
|
|
Rank: Administration
Posts: 3
|
Ray you'll want to use regular expressions as your inputs. Sadly I have to go re-learn them every time I use them, so off the top of my head I can't say whether your examples are valid or not (I'll guess they aren't since you're not getting results). I am trying to find out more about how this check works, and I'll let you know as I find out more. In the interim try to see if you can get your patterns to match with this online tool. http://www.fileformat.info/tool/regex.htm If you can get it to match there, I'd think it will match in the check. There's some regex doc links towards the bottom of that page too, I always have to look that stuff up.
|
|
Rank: Newbie
Posts: 3
|
Thanks Mark - yep, I've tried 3 different examples in that pattern match tool and they all work, but won't work in the extension. Oh well ...
For example, all of the following would work:
mine. mine[0-9] mine\d
If I was trying to find the following in a config ..
mine1 mine2 mine3
|
|
Rank: Member
Posts: 2
|
I tested these exact scenarios successfully. Here are my configuration settings. Let me know if these don't work for you:
Example 1:
Context: .* fileName: running-config ShouldFind: True String: nameif ethernet\d
Example 2:
Context: .* fileName: running-config ShouldFind: True String: aaa-server ACS \(inside\) host 9.9.9.9 .* timeout 5
A few notes:
1. Spaces matter. Make sure you don't have preceding or trailing spaces if you don't mean to. 2. Context could either be "Global" or ".*" in these cases you mention. 3. You have to escape the parenthesis when trying to match (inside), which is why the example above is \(inside\)
If these don't work, could you copy a snippet of your config you are trying to match and the exact inputs you are using?
|
|
Rank: Newbie
Posts: 3
|
Jody - Thanks for the excellent examples, I'm straight now.
One other question, I don't get the difference between Global and ".*" for context. But the line I'm looking for is indented, and doesn't get found using Global; but does with .*.
Thanks again, Ray
|
|