/build/static/layout/Breadcrumb_cap_w.png

Systems Management Question


Create smart labels by parsing computer name. Use regex?

11/21/2019 260 views

As many of you probably do, we create our computer names using a combination of location, employee role, and computer number. I want to create smart labels that just looks at the middle part of the name. Our computer name is like this: ABCD1234YZ. Where 1234 is the part I want the smart label to look at. There’s always the same number of characters in each of the sections. 4 characters in ABCD. 4 characters in 1234. 2 characters in YZ.

The ABCD section has 15 different variations and more that will get created soon. Needless to say, it would be pointless and tedious to add a line to the smart label to account for each of those 15 variations. I’m wondering if there’s a way for the smart label to basically ignore the ABCD section of the computer name and only look at the 1234 part. I’m imagining something like this.

-          First smart label: Computer Names that match “####1234##”

-          Second smart label: Computer Names that match “####5678##”

-          Third smart label: Computer Names that match “####9012##”

My assumption is that this might be possible using some regex hocus-pocus. I’m just not familiar enough with regex. Any ideas?

2 Comments   [ + ] Show comments

Comments

  • You could use system name like %1234%
    or with a regex
    Ssystem name match regex ^.{4}1234.{2}
    • Yep, no need for regex, just use the wildcard.
      • By wildcard, do you mean the percent sign (%) like above or the asterisk (*)? I think I tried the asterisk and it didn't work.
      • In SQL the wildcard character is the percent sign and not the asterisk.
  • I think I was confusing myself between the actual SQL code and the web interface.

    You can use System Name Contains 1234

Be the first to answer this question