HISE Logo Forum
    • Categories
    • Register
    • Login

    Regex on windows

    Scheduled Pinned Locked Moved General Questions
    12 Posts 4 Posters 608 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.
    • A
      arminh
      last edited by

      I have some issues with regex on Windows.

      I finished my project on Mac and i opened it on Windows but it looks like regex not working.

      On Mac i using regex to cut file name and push it to array but on windows it's not working and i see whole path to file insted (f.ex. file.wav).

      1 Reply Last reply Reply Quote 0
      • A
        arminh
        last edited by

        BUMP

        On mac i have

        var regexed = Engine.getRegexMatches(p, "[^/]*$");
        

        any idea how make it work on windows?

        1 Reply Last reply Reply Quote 0
        • A
          arminh
          last edited by

          I also don't know why strings in my path array in ScripWatchTable looks like this

          "C:\\Users\\armin\\AppData\\Roaming\\My Company\\Demo Plugin\\AudioFiles\\factory_1.wav",
          

          and when i Console.print it it looks normal (single slash)

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

            Windows uses \ as a directory separator. Sensible operating systems use /. \ is also an escape character, so when you try to write a directory name on Windows you have to use \\ one is the directory separator, the other is the escape character to tell Windows that the other one is the directory separator and not an escape character :p

            Another solution (in the command line at least) is to place the path in quotes "" and just use one \

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

            A 1 Reply Last reply Reply Quote 1
            • A
              arminh @d.healey
              last edited by

              @d-healey ok thanks for explanation but i still don't know how to fix it :D I hate regex.

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

                @arminh said in Regex on windows:

                @d-healey ok thanks for explanation but i still don't know how to fix it :D I hate regex.

                I'm not good with regex which is why I avoided answering the question :p

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

                A 1 Reply Last reply Reply Quote 0
                • A
                  arminh @d.healey
                  last edited by

                  @d-healey anyway, thanks :D I'm currently in the moment that I can pull out a file extension :D Wish me luck.

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    arminh @arminh
                    last edited by

                    ANSWER IS

                    [^\\\\]*$
                    
                    1 Reply Last reply Reply Quote 0
                    • Christoph HartC
                      Christoph Hart
                      last edited by

                      If you need to distinguish the regexes based on the OS, use Engine.getOS()...

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        arminh @Christoph Hart
                        last edited by

                        @Christoph-Hart thanks :)

                        NatanN 1 Reply Last reply Reply Quote 0
                        • NatanN
                          Natan @arminh
                          last edited by

                          @arminh Bro, What This Regex Thing Stands For?
                          Where You Find Your Self To Use This Code?

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

                            @Natanr https://en.wikipedia.org/wiki/Regular_expression

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

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

                            16

                            Online

                            1.7k

                            Users

                            11.8k

                            Topics

                            103.1k

                            Posts