
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 03:14 PM
I wanted to populate the firmware version field for our network devices and ran across the following HI article.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0793931
Followed it and it worked for our Cisco devices. However we have other brands as well including Arista which is the next one I was trying to implement.
I'm no expert with regex so that is part of the reasoning for my post.
The Cisco regex, as you can see in the previous link, is: Cisco.*Version\s([^,]+),
The string...and it returns and populates the firmware version field with what's in bold.
Cisco NX-OS(tm) nxos.7.0.3.I4.7.bin, Software (nxos), Version 7.0(3)I4(7), RELEASE SOFTWARE Copyright (c) 2002-2013 by Cisco Systems, Inc. Compiled 6/28/2017 13:00:00
Fabric Stack Root
System OID: 1.3.6.1.4.1.9.12.3.1.3.1467
On to my Arista regex issue. The string for it is this...
Arista Networks EOS version 4.21.5.1F running on an Arista Networks DCS-7280SE-72
48 SFP+ +2 MPO 100Gb 1RU
System OID: 1.3.6.1.4.1.30065.1.3011.7280.3714.72
When I entered this regex, Arista.*version\s([^,]+)\s it returned what I put in bold. and entered '4.21.5.1F running on an Arista Networks' into the firmware version field. That's me just throwing a guess out there 🙂
Thanks in advance!!!
Solved! Go to Solution.
- Labels:
-
Discovery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2022 11:05 AM
Try Arista.*version\s([^\s]+) instead. This will only capture the version number.
Also have a look at https://regex101.com/. Its a great tool for writing and debugging regular expressions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2022 10:07 AM
So I was able to update the regex and capture what I wanted to. However it's not the way I'm wanting to do it.
When using the following regex .match(/Arista.*version\s([^,]+) run/) I'm able to pull what's in bold.
Arista Networks EOS version 4.21.5.1F running on an Arista Networks DCS-7280SE-72
48 SFP+ +2 MPO 100Gb 1RU
System OID: 1.3.6.1.4.1.30065.1.3011.7280.3714.72
My issue is I'd rather not limit the last match to the specific characters of 'run'. However when I try to use \ it does not work. I've tried \s to have a final match of a space and so forth. Stuck...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2022 11:05 AM
Try Arista.*version\s([^\s]+) instead. This will only capture the version number.
Also have a look at https://regex101.com/. Its a great tool for writing and debugging regular expressions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2022 11:22 AM
Thanks!! So this worked, but I think it makes sense now. It's saying to look for 'Arista and then 'version\s' and return anything past 'version\s' that is NOT a whitespace, meaning until a whitespace is found. Is this correct?
I use https://regex101.com/ and others. Thanks for the suggestion. Still a bit confusing to use when you're understanding of it is still growing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2022 04:00 PM
Yes, your interpretation is correct.
Also, keep in mind that regex used within the Pattern Designer has the case insensitive flag hard corded. You may be able to use one expression for Cisco, Arista and other manufacturers with slight modifications. The following works for Cisco and Arista since both have the word version preceding the firmware version number: version\s([^,\s]+) Note the exception list [^,\s] now contains both a comma (,) and any whitespace (\s) character to identify the end of version number for Cisco and Arista, respectively.