Community
    • Login

    Function List for UDL - multi-line regex

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 5 Posters 551 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.
    • J
      Jeb Dude
      last edited by

      I’ve noticed that many of the predefined Function List languages have large multi-line regex. I have tried to do the same in my UDLs, but it doesn’t work.

      I can literally take a regex that works in capturing a class/function, add a line break (CRLF) and it simply doesn’t work anymore. Having said that, I’m also not sure if the # comments that I see in the pre-defined Function List langs works at all in the UDLs. I’ve tried it, but it seems to make no difference, with or without.

      Is it possible to use multi-line regex in Function List for UDLs?

      I’m using v8.4.6, but I’m sure this affects other versions as well.

      Terry RT 1 Reply Last reply Reply Quote 0
      • Terry RT
        Terry R @Jeb Dude
        last edited by Terry R

        @Jeb-Dude said in Function List for UDL - multi-line regex:

        Is it possible to use multi-line regex in Function List for UDLs?

        According to this post, no, not even any regex.

        Terry

        PS also read the online manual for more background on UDL, here.

        J 1 Reply Last reply Reply Quote 0
        • J
          Jeb Dude @Terry R
          last edited by

          @Terry-R

          Thanks for the reply. This is not actually the UDL itself. It is the Function List as it is applied to the UDL in xml files (within the functionList folder). The regex works for my UDL, and I can have the function list populate functions and classes as expected.

          I just can’t seem to use multi-line regex (breaking up a long complex pattern across multiple lines). This “multi-line” regex is used in Function List xml files for predefined languages.

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @Jeb Dude
            last edited by PeterJones

            @Jeb-Dude ,

            You mean (?x) in the regex, to allow splitting the regex across multiple lines in the function list XML file? Yes, that’s allowed, as seen in many of the function list definitions distributed with Notepad++. You can use that syntax in any function list definition, whether it’s for a builtin lexer language or a UDL.

            You probably have a mistake in the conversion from single-line to multi-line: my guess is that when you created the multi-line version, you still expected it to match a space when you typed a space. Since (?x) actually means “Ignore non-escaped whitespace in regex”*, not “allow mulitiline”, if you want to match a space or newline inside that regex, you need to encode it appropriately as \h (any horizontal whitespace, including ASCII 32 space and TAB) or \r\n (windows CRLF) or similar, or \x20 to get only the ASCII 32 space.

            But since you don’t show us anything, we cannot actually say for sure what you’ve done wrong.

            J 1 Reply Last reply Reply Quote 2
            • J
              Jeb Dude @PeterJones
              last edited by Jeb Dude

              @PeterJones

              Thanks! My apologies. I should have read the regular expressions help
              more carefully. I see it now.

              Thanks again!

              EDIT: Just wanted to add that you nailed the issue I was having almost exactly. Except that I didn’t even realize (?x) existed as an option. Once I realized that, I found it in the docs immediately and understood what I needed to do.

              1 Reply Last reply Reply Quote 1
              • guy038G
                guy038
                last edited by guy038

                Hello, @Jeb-dude, @peterjones, @terry-r and All,

                To @jeb-dude :

                Refer to the end of the post below ( Notes section ) for some explanations regarding the free-spacing mode (?x) :

                https://community.notepad-plus-plus.org/post/81368


                To @peterjones :

                These explanations, regarding the (?x) mode, could be added to the Official N++ Documentation, if you’ll find some spare time ;-))

                Best Regards,

                guy038

                J 1 Reply Last reply Reply Quote 1
                • J
                  Jeb Dude @guy038
                  last edited by

                  @guy038

                  If I’m not mistaken, it is in the docs, but it’s under the “Searching” page, and there is no explicit link mentioned in the “Function List” page to check out the “Searching” page.

                  In my opinion, that would suffice. I just wasn’t aware that the “Searching” section applied to the config files for “Function List” stuff.

                  Lycan ThropeL 1 Reply Last reply Reply Quote 0
                  • Lycan ThropeL
                    Lycan Thrope @Jeb Dude
                    last edited by Lycan Thrope

                    @Jeb-Dude ,

                    That’s because that entire page pertains to the Regex aspect. If you notice there are links on both sides of the page in the browser. The ones on the left are main links, the ones on the right are the sectional links in that subject…and because it’s an extensive subject, it’s broken down into many sections. By the way, why learn Regex, if you’re not searching? :) It just stands to reason that, that is what you’re using Regex for. :)

                    J 1 Reply Last reply Reply Quote 0
                    • J
                      Jeb Dude @Lycan Thrope
                      last edited by

                      @Lycan-Thrope

                      Of course, I realized that after @PeterJones posted his answer.

                      1 Reply Last reply Reply Quote 1
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors