ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Unsolved Need Regex Help

    IT Discussion
    regex
    6
    27
    1.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DustinB3403D
      DustinB3403 @nadnerB
      last edited by

      @nadnerb said in Need Regex Help:

      Have you seen: https://regex101.com/
      I got shown that the other day. Looks like it might be of some assistance.

      I'm on regexr.com right now but will take a look at regex101.com in a moment.

      1 Reply Last reply Reply Quote 0
      • 1
        1337 @DustinB3403
        last edited by 1337

        @dustinb3403 said in Need Regex Help:

        Hey all,

        I need some help with some regex, which I admittedly never use in my day to day.

        The goal is I want to search a list of software across multiple systems and key in on 3 specific names and only list the systems that specifically don't have any of those 3 names.

        IE

        Computer Name | Application
        bobs-pc | Microsoft
        bobs-pc | Libre
        bobs-pc | MyTax
        Sarahs-pc | Anti-virus
        Sarahs-pc | MyTax
        Sarahs-pc | Libre

        The output I would like to list

        Bobs-pc since it doesn't have Anti-Virus and Sarahs-PC because it doesn't have Microsoft.

        Anyone able to help me sort this out?

        You can also use grep for that. An inverted search (-v) will give you all the lines that doesn't contain your search string.
        grep -v searchstring file

        And if you have multiple search strings:
        grep -v "search1\|search2\|search3" file
        or
        grep -v -E "search1|search2|search3" file

        Or maybe not when I closer at your file.

        You will actually not be able do this with grep or regex or any other simple utility in a simple way.
        You will need a script for this.

        DustinB3403D 1 Reply Last reply Reply Quote 0
        • DustinB3403D
          DustinB3403 @1337
          last edited by DustinB3403

          @pete-s I can't use grep for this specific function as I'm limited regex or known string searching only through BrightGauge.

          1 1 Reply Last reply Reply Quote 0
          • DustinB3403D
            DustinB3403
            last edited by

            The regex inverse match is

            \b(?!:Microsoft|Libre|MyTax)\b
            

            But this will list literally every other piece of software found, and not the exclusions of "I've not found this software on "Bobs-pc" or on "Sarahs-pc"

            1 Reply Last reply Reply Quote 0
            • 1
              1337 @DustinB3403
              last edited by

              @dustinb3403 said in Need Regex Help:

              @pete-s I can't use grep for this specific function as I'm limited regex or known string searching only through BrightGauge.

              If you can't make scripts to massage the data in BrightGauge, I don't think it's possible.

              DustinB3403D 1 Reply Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403 @1337
                last edited by

                @pete-s said in Need Regex Help:

                @dustinb3403 said in Need Regex Help:

                @pete-s I can't use grep for this specific function as I'm limited regex or known string searching only through BrightGauge.

                If you can't make scripts to massage the data in BrightGauge, I don't think it's possible.

                That's kind of what I'm feeling. . . but hopes and prayers I can pull something out of my hat. . .

                1 Reply Last reply Reply Quote 0
                • DashrenderD
                  Dashrender
                  last edited by

                  Is there anyway to pull the data out so you can use the tools you want?

                  DustinB3403D 1 Reply Last reply Reply Quote 0
                  • DustinB3403D
                    DustinB3403 @Dashrender
                    last edited by

                    @dashrender said in Need Regex Help:

                    Is there anyway to pull the data out so you can use the tools you want?

                    I want to use BrightGauge because I dont want to have to handle the data on an on-going basis. But yes I could export the data, and filter it down to show me just the "These don't have that" in excel which, that is actually already done.

                    But its still incredibly annoying to have to review.

                    The end goal is to have a list of systems that are simply lacking one piece of software or another, and to not have to view everything other piece of software with it. So that the lacking software can be installed.

                    1 1 Reply Last reply Reply Quote 0
                    • 1
                      1337 @DustinB3403
                      last edited by 1337

                      @dustinb3403 said in Need Regex Help:

                      @dashrender said in Need Regex Help:

                      Is there anyway to pull the data out so you can use the tools you want?

                      I want to use BrightGauge because I dont want to have to handle the data on an on-going basis. But yes I could export the data, and filter it down to show me just the "These don't have that" in excel which, that is actually already done.

                      But its still incredibly annoying to have to review.

                      The end goal is to have a list of systems that are simply lacking one piece of software or another, and to not have to view everything other piece of software with it. So that the lacking software can be installed.

                      You could pull the data same as BrightGauge does, have a script do something to it and then send it into BrightGauge but it's another level of difficulty.

                      Have you contacted support? They might have another way of accomplishing it.

                      DustinB3403D 1 Reply Last reply Reply Quote 0
                      • DustinB3403D
                        DustinB3403 @1337
                        last edited by

                        @pete-s said in Need Regex Help:

                        Have you contacted support?

                        Yes, just waiting for a reply.

                        1 Reply Last reply Reply Quote 0
                        • scottalanmillerS
                          scottalanmiller @DustinB3403
                          last edited by

                          @dustinb3403 said in Need Regex Help:

                          I need some help with some regex,

                          Every tool has its own regex. Which regex do you need?

                          DustinB3403D 1 Reply Last reply Reply Quote 1
                          • DustinB3403D
                            DustinB3403 @scottalanmiller
                            last edited by

                            @scottalanmiller PostreSQL regex

                            scottalanmillerS 1 2 Replies Last reply Reply Quote 0
                            • DustinB3403D
                              DustinB3403
                              last edited by

                              So nothing?

                              1 Reply Last reply Reply Quote 0
                              • scottalanmillerS
                                scottalanmiller @DustinB3403
                                last edited by

                                @dustinb3403 said in Need Regex Help:

                                @scottalanmiller PostreSQL regex

                                Oh wow, I've never used regex in a database before. No idea of that syntax or where/when you'd use it.

                                1 1 Reply Last reply Reply Quote 0
                                • 1
                                  1337 @scottalanmiller
                                  last edited by

                                  @scottalanmiller said in Need Regex Help:

                                  @dustinb3403 said in Need Regex Help:

                                  @scottalanmiller PostreSQL regex

                                  Oh wow, I've never used regex in a database before. No idea of that syntax or where/when you'd use it.

                                  It either used for string manipulation or string matching.

                                  From the top of my head with syntax errors included.

                                  For example manipulating strings (convert email to domain name)

                                  select name, regexp_match(email,'.+@(.+)') as domain
                                  from customers
                                  

                                  For example matching to a simple regexp (all customers that have the has John somewhere in their name):

                                  select * from customers where customer_name ~ 'John'
                                  
                                  1 Reply Last reply Reply Quote 1
                                  • 1
                                    1337 @DustinB3403
                                    last edited by 1337

                                    @dustinb3403 said in Need Regex Help:

                                    @scottalanmiller PostreSQL regex

                                    It's easy to solve this problem with SQL - if that is a possibility.
                                    You just need to use a subquery.

                                    I'm assuming a table that contains one column with computer name and another with software installed. One row for each software installed.

                                    For example a query to find all computers that have the software installed:

                                    select computer_name 
                                    from yourtable
                                    where 
                                       software_installed='Microsoft' or
                                       software_installed='Anti-virus'
                                    group by computer_name
                                    

                                    Now we'll use that as a subquery to show all the computers that doesn't have the software installed:

                                    select computer_name from yourtable
                                    where 
                                       computer_name<>(
                                          select computer_name from yourtable 
                                          where 
                                             software_installed='Microsoft' or 
                                             software_installed='Anti-virus'
                                          group by computer_name
                                       )
                                    group by computer_name
                                    

                                    The group by is to show a computer name just one time, even if you have several rows that contains that name.

                                    Note: Syntax errors probably included in my examples.

                                    DustinB3403D 1 Reply Last reply Reply Quote 1
                                    • DustinB3403D
                                      DustinB3403 @1337
                                      last edited by DustinB3403

                                      @pete-s Thank you for the help, unfortunately it appears I'm limited to PostgresSQL regex like below or directly selecting the installed software from the list of thousands of items.

                                      msedge_JFxMQbHVOB.png

                                      \b(?!:Microsoft|Anti-Virus)\b
                                      

                                      I have no options for a subquery, at least that I can see at the moment.

                                      1 travisdh1T 2 Replies Last reply Reply Quote 0
                                      • 1
                                        1337 @DustinB3403
                                        last edited by 1337

                                        @dustinb3403 said in Need Regex Help:

                                        @pete-s Thank you for the help, unfortunately it appears I'm limited to PostgresSQL regex like below or directly selecting the installed software from the list of thousands of items.

                                        I have no options for a subquery, at least that I can see at the moment.

                                        Yeah, well you're not going to find a regex solution. Simply because you need to look at several rows of information to determine if the computer has software or not. That's why it's not going to work.

                                        If you could put have all the software into one column then you could use regex to find the rows that doesn't have the software installed. So if you had a string with "Microsoft,Libre,MyTax,Anti-virus " you could use regex on that and it would work fine.

                                        DustinB3403D 1 Reply Last reply Reply Quote 0
                                        • DustinB3403D
                                          DustinB3403 @1337
                                          last edited by

                                          @pete-s yeah that is what I'm feeling as well. . . sadly. This really needs to be somehow capable with the tooling, even if I'm not able to implement it.

                                          1 1 Reply Last reply Reply Quote 0
                                          • 1
                                            1337 @DustinB3403
                                            last edited by 1337

                                            @dustinb3403 said in Need Regex Help:

                                            @pete-s yeah that is what I'm feeling as well. . . sadly. This really needs to be somehow capable with the tooling, even if I'm not able to implement it.

                                            I haven't heard of BrightGauge before. Maybe it's big in the market, I don't know.

                                            Regardless of that, it looks very capable on their website but that's because that's what marketing does - makes things look good.

                                            The actual technical capability of the product is unknown until it's put to use. In your case unfortunately it looks like the product can't get the job done.

                                            Maybe you're trying to hammer with a screwdriver or the hammer you have is just crap. In either case the support should be able to help you.

                                            DustinB3403D 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 2 / 2
                                            • First post
                                              Last post