HISE Logo Forum
    • Categories
    • Register
    • Login

    Regex < > Not Working

    Scheduled Pinned Locked Moved Scripting
    29 Posts 4 Posters 1.2k Views
    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.
    • Dan KorneffD
      Dan Korneff
      last edited by

      I could use an extra set of eyes on this function. I'm using regex to validate serial numbers, but I just can't get it to work.

      var matches;	
      const serialText = "PEE-CLU51-I368X-896M2-JT6Q5-POOP";
      
      //validate serial number
      inline function validateSerialNumber(serialNumber)
      {
      
      
          // Define patern
          local serialPattern = "^[A-Z]{3}-[0-9A-F]{5}-[0-9A-F]{5}-[0-9A-F]{5}-[0-9A-F]{5}-[A-Z]+$";
      
          //find matches
          matches = Engine.getRegexMatches(serialNumber, serialPattern);
      
          // If there is a match
      	if (matches.length == 1 && matches[0] == serialNumber)
          {
      		Console.print("Valid");
              return true;
          }
          else
          {
              Console.print("Not Valid");
              return false;
          }
      }
      
      validateSerialNumber(serialText);
      

      This returns false even though the serial number matches the regex pattern

      HiseSnippet 919.3ocsV01aaaCDlxIpXRcaXEn+.HB1JbvpRraZ7RQPvZheYva0IZ0oAEMHsfU5jMQjIEnnxhQP9O2+AaGkjeqIMM0.ievP7t643COx6g1WICfzTohX4b73DfX8818GKzCaNjwEjtsHV+ncOVpFTzBSGLNgklBgDKqU9CiAKmUI4iO86GvhYh.XlIB4DIO.dEeDWOyp+K+KdbbGVHbLezbQ+7W1MPJZJikYHeVwtFIgEbNa.bHyDVEah0CZGx0RUeMSCoXLGHCG2en7eDEweBOk+wXvLoNoOlnByjlC4wg9S1qoDh0p9y14qTryercOdHep8YUfeJ2AcFh4qAVUtKJU+afRVyQoUKnzir6Gn3I5YdL74g1cE3ARDCK0ySkhXIU9kUraJwHD5MFwNG5nvISQTsQsZOkh+r9tttWvTzQLcvPHcWGWr3mpoofhyhOFtTS2itle61dMe0a1ttW2sZrya814EM58Lu+73F+81d9Gcj+ZXV1byKXw7Pb+WBlJxF8QP4xEwbAPixDAZtTPmDV+7nNLOnpoyMYc2qbcco3XyMosfHC5DDfRjaLVFfIu.fOSara336Oceu2c1Uacs2o07dw9dcN6psumea.9q+rYSTrn3JFNohjap7abYZKFfzYiAf90v.3xdENVf9OcQts9zzR6FQ0CAEP4oTVQRcc3Qzpk4eiXPLPOjt2dz5zm7jIK6o0NyXZwRjIkW453fmwoxXXiDEWnqt1Ilh6Z3ZRKGJPmgEHsJCJLdc9uPbJTliIQ9YY5Pol9kxVDCgOIcWatA8EORMWgVe2oG9RAlW3HQUygrChk94thhtUel6xJYbLl3aysQCQcW.qJJObPtlASCDaxVry8A2uN2fhVq4BTJ5J35iRfx4cjwglNRy22rOmT1ahe8ltsXZlo0uzFFWBnzbCcrZAWfZmEBAN1sfzy0xDT87FpDn9jLLKloWTzxnNW5.qGKnTXTCDob834Uu+FTxpcmJY2WJ9HaeNdM+14XkagiXk5+CNVp++C1sihf.8LBtpcm2trh8ekk+0xLMWL.UQT7KIV1XmSe7Yu..Wcg.6QQaVUL2VJlWyL2TA5Chv7I+KNJcV2L2pzY8INIiXAJ4GBJ5BLuv7c4VPNIxeP0AeYGmSqSx6LluNOBev6CAAKlpa.7YKKvsVVfOeYAt8xBrwxB72VVf670AZ9+H6mokiJZaHjd9sykRrrZKX3Mv7aqj+CatSxuA
      

      Dan Korneff - Producer / Mixer / Audio Nerd

      d.healeyD CasmatC LindonL 4 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @Dan Korneff
        last edited by

        @Dan-Korneff I wouldnt bother with this. It's too easy to make a keygen for it.

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        1 Reply Last reply Reply Quote 0
        • CasmatC
          Casmat @Dan Korneff
          last edited by

          RSA Keys!

          i make music

          1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @Dan Korneff
            last edited by

            @Dan-Korneff yep - head for those RSA key pair hills right now...

            HISE Development for hire.
            www.channelrobot.com

            1 Reply Last reply Reply Quote 0
            • Dan KorneffD
              Dan Korneff
              last edited by

              I was using it just to reduce traffic to my license server. No need to hammer my phpworkers with nonsense 😄

              Dan Korneff - Producer / Mixer / Audio Nerd

              1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @Dan Korneff
                last edited by

                @Dan-Korneff said in Regex < > Not Working:

                This returns false even though the serial number matches the regex pattern

                How do you know it matches? Do I smell ChatGPT?

                I always use regex101 for testing - https://regex101.com/

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                Dan KorneffD 1 Reply Last reply Reply Quote 0
                • Dan KorneffD
                  Dan Korneff @d.healey
                  last edited by

                  @d-healey I asked my best friend, chatGPT, and she agrees it matches :cat_face_with_tears_of_joy:

                  Dan Korneff - Producer / Mixer / Audio Nerd

                  d.healeyD 1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @Dan Korneff
                    last edited by

                    @Dan-Korneff Knew it 😃

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    Dan KorneffD 1 Reply Last reply Reply Quote 0
                    • Dan KorneffD
                      Dan Korneff @d.healey
                      last edited by

                      @d-healey omg.... [0-9A-F] is limiting the character to A-F. Obviously I want A-Z.

                      Dan Korneff - Producer / Mixer / Audio Nerd

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post

                      54

                      Online

                      1.7k

                      Users

                      11.7k

                      Topics

                      101.8k

                      Posts