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.
    • d.healeyD
      d.healey @Casmat
      last edited by

      @Casmat I think we've been here before https://forum.hise.audio/topic/8164/regex-help/15

      :beaming_face_with_smiling_eyes:

      4cba9461-d5ba-44d2-a995-2f783d29ab54-image.png

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

      CasmatC 2 Replies Last reply Reply Quote 0
      • CasmatC
        Casmat @d.healey
        last edited by

        @d-healey Hise must have given me memory loss đŸ˜²

        Thanks David!

        i make music

        1 Reply Last reply Reply Quote 0
        • CasmatC
          Casmat @d.healey
          last edited by

          @d-healey Hmm, need help on this, I know its going to be something silly haha:

          reg s = '<?xml version="1.0" encoding="UTF-8"?>
          
          <Preset Version="1.0.0">
            <Content Processor="Interface">
              <Control type="ScriptControl" id="amazingId" value="0.0"/>
            </Content>
            <Tags>
              [synth,pad,pluck]
            </Tags>
            <MidiAutomation/>
            <MPEData Enabled="0"/>
          </Preset>
          ';
          Console.print(Engine.getRegexMatches(s.replace("\n"), "<Tags>(.*?)<\/Tags>")[1].trim());
          

          That doesn't work, any ideas?

          i make music

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

            @d-healey

            reg presetList1 = FileSystem.findFiles(folderUserPresets, "*.preset", true);
            
            for(i in presetList1)
            {
            	reg presetHolder1 = i.loadAsString();
            Console.print(Engine.getRegexMatches(presetHolder1.replace("\n"), "<Tags>(.*?)<\/Tags>")[1].trim());
            };
            

            This was my original code and presetHolder1 contains the xml like:

            @Casmat said in Regex < > Not Working:

            [synth,pad,pluck]

            i make music

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

              Works here

              387c303e-2c4d-47b2-96fc-595030a13656-image.png

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

              CasmatC 1 Reply Last reply Reply Quote 0
              • CasmatC
                Casmat @d.healey
                last edited by

                @d-healey Bug? Im on the latest version of hise on windows 11..

                i make music

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

                  @Casmat

                  Im on the latest version of hise on windows 11..

                  What do you mean by latest version?

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

                  CasmatC 1 Reply Last reply Reply Quote 0
                  • CasmatC
                    Casmat @d.healey
                    last edited by

                    @d-healey oops I meant latest build on the fix SNEX node handleModulation() function not creating a modulation… commit

                    i make music

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

                      @Casmat Well that's the same as I'm using. So using only the code posted above in my image you are not getting the same result?

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

                      CasmatC 1 Reply Last reply Reply Quote 0
                      • CasmatC
                        Casmat @d.healey
                        last edited by

                        @d-healey nope..

                        i make music

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

                          @Casmat Well Windows does have a tendency to behave weirdly with back and forward slashes, so it could be OS specific. I'll fire up my Windows VM and test.

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

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

                            Works for me on Windows.

                            Here's the snippet just for reference

                            HiseSnippet 841.3ocsUEtaaaCDlxIpXVcaXEXO.D5O0tvywdqsq.0NoMI1EFaI0nNMX.sEErTmsIhDo.IUVbG167dCVOJpDauDj1ZfoeHn6tu6tOd7tSi0JNXLJMIn9IKxARv2FNYgzN+f4LgjL5PRv2GdDyXAM0qZ+E4LiARHAAa8Bmhf5aSJe9m81mkxjbXoJB4TkfC+tHSXWpc7y9MQZ5PVBbhHaEzO7Yi3J4ApTUAxmsB6PxY7yXyfiYNX0BIA2YPhvpzSrLKXPL6qRVLYt5Okd7mJLhOjBNgtjIXf7pIGLWjlL9xypgPB1d7xS9V9S9OFdjHQbk9kUfenz.coGqVCBpcaTp6WAkBVgRa6oz8Bmv0hb6RKN9b2vQR7BYJCK0qREOVRsGUK7.EhPZamwNCFpQgq7nwi6zoEEe07oQQZXF0P6Sueu8tHKkdNnMBkreb21chofjqRDxY8ie8IC+omDu2tQQ8FqACXomtBRD6tQTZupbtrN0O9prVhnBiVkRs3wqermvU5hohj9wrL1GwbNJIldNKs.A4h+NkIXmpLTJbBalwGz2XbMrsxYIsxSK3m8tRrWZum6t64EVUFyhL1GoiFO3PlkQGHY3cCl1xTzaG+oa26ikFLWFUJzNWKj1FCjyDRn8Lv9JXFbwQLKeNXZXZqg7TWUM9sx3lsnwdd0n8C1qYu25IQby2z8cssZQVilMe5zBI2QDpRdrxBuT1nYzeEUO5uin+WSSmdi1ppWof9FM6loz2liMjEYe.zs7E3q.hMcq2IemurNYt+RYEfJ4Hov9xbnRdnJMw0g599588jpaU7qWOxcq3FEpzg3xAsU3nSvgv43tD+fQ8vCAyYVUNtM4ZSM37pJoHkYWeH1sspx.VOVaxw0mJMB6hU2l8ULY24Vmr+Ro38BGKv9pali0tANhUp+O3X09vuKbvzo.2tjfaGN7O1zkeelz+JUgEm6wAKs3BRP3wEYSveCvAL6RIjhAOLnlqawK2wI6p.S.YRov+hOUF65jCpL18RijLFWqdO2OE3139MkZPNIK+ASc7OcnLsKobxX05bFtD48b95g5ZN9yapi+xl53C2TGezl53i2TG+0M0wm74cb8c7HfpE7XOZ0JdW2J4SAcefo.
                            

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

                            CasmatC 1 Reply Last reply Reply Quote 0
                            • CasmatC
                              Casmat @d.healey
                              last edited by

                              @d-healey have to test, but I think it may be an issue I had when building, I updated by cleaning solution in vs and using git pull to update (also deleted all files and tried git reset —hard).. but when I opened the new hise after building, the first welcome popup still appeared and there were still recent projects popping up even if it was a clean install.. what is the proper way to update hise

                              i make music

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

                                @Casmat

                                recent projects popping up even if it was a clean install

                                Well you don't really install HISE, you just built the binary and run it. The recent projects list will be saved in HISE's app data folder.

                                Git pull is the correct way to update. If you're running into issues I suggest you delete your HISE folder and rebuild from scratch.

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

                                CasmatC 1 Reply Last reply Reply Quote 0
                                • CasmatC
                                  Casmat @d.healey
                                  last edited by

                                  @d-healey Ok just found something extremely weird which is the problem causer:
                                  2023-11-20 15-58-58 (1).gif

                                  Basically my s variable in use would be preset files open with the loadAsString() function. For some reason, theres a "hidden" character (even though I couldn't find it with this tool). Any ideas?

                                  Here's a snippet:

                                  HiseSnippet 850.3ocsU01aSjCD1aZ2Sjv0SGR7CvZ+BInPZxc7lDITnsImhtqkHRo5j.Dx3cRhU20dks2RCH9Oy+f6FGujrABnSQG6GVsyLOimGOusizJNXLJMIn5Yyy.RvOGNdtzN6nYLgjL7XRvuDdByXAM0q5v4YLiAhIAA67GNEAU2kr34SGbHKgI4vJUDx4JAG9KQpvtR6nm7mhjjArX3LQZIz28IC4J4QpDUNxmcBaSxX7KXSgSYNXUBIA+T+XgUoGaYVvPB18PU77wyTuS5wetvHdaB3D5PFiGjW8.URriwNsjilIRhG846sgfmxnUYgc7YgaFdhHVrT+prwutv.ckGkyGAUVmd6rF85TldsKQuMPofRTZWOktQ3XtVjYWYwwmqGNThEmILLsWlJdrjJGVI7HEhPZakxt.FnQgkdT+9sa2jhuZ7nZ0zvTpg1idqtGbUZB8RPaDJYunNsZGQAIWEKjS6E8hyFbmGFcvi2q1d05NRCFvROuDVDMZiR6VD1UopdQKCrGRAHsJgZwqXuHOoKzEQEw8hXor2iwcXbD8RVRNBxEg88gX+hX3kNiM0Tbtuz35galwhalkjyu30d3KQz0UDeZtUkxrHwKNtSF0+XlkQ6KYXUBCtOPc22eMwOuElmvXZTIPqLsPZq2WNUHgVSA6ygovUmvr7YfotokFxRbo3nWIiZzjF4oW8V29fFcekmIQMdYmW2xpEo0az3QSxkbGYnJ4oJK7LY8F09Psp09XM5WZZxjMZqHwk.5MZ1Mro+dNVWlm9VP2zmoWBD6.WusN7a2VWdpi6KNk.pjCkB6yx.42ZVjTTQwudwPWwvMKTnCwkAZqvQgfigKwEK9IipgGClKrpLb0xWM1fCrp37Dlc8oX2pqBCXNXsQGWWpzHryKuZ6+sQ6+qT7FgiDXuzl4XkMvQLS8ifiEKD2Kr+jI.2thf6FN3u+wr8i7bUtEG5wgIs3Jre6z7zw3+D3.FcoDRb8fAUbcKd41NYWFXLHiWH7O3SgwNN4fBic9rQRJiqUug667cqbu1BMHmjK9aSU72dnLsCYwz.5WHt4gjhKNdCm6t92Aaf2rO+1V3yuuE9b2svm6sE9b+svmGrE97vuqOquyFKnE6qwduhM1ttPx+BYvXZaA
                                  

                                  Thanks!

                                  i make music

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

                                    @Casmat It's the Windows line ending. \r\n

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

                                    CasmatC 1 Reply Last reply Reply Quote 0
                                    • CasmatC
                                      Casmat @d.healey
                                      last edited by

                                      @d-healey haha, thats nice! Does it matter if that \r is included in macos/linux versions?

                                      i make music

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

                                        @Casmat Doesn't matter on Linux (that's what I'm using now), probably doesn't on Mac either, it's usually Windows that is the odd one out. But give it a good test before releasing it into the wild.

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

                                        CasmatC 1 Reply Last reply Reply Quote 1
                                        • CasmatC
                                          Casmat @d.healey
                                          last edited by

                                          @d-healey Thanks again David!!

                                          i make music

                                          1 Reply Last reply Reply Quote 0
                                          • 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
                                            • First post
                                              Last post

                                            54

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.8k

                                            Posts