Community
    • Login

    Line return

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 4 Posters 670 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.
    • Sylvain JeanS
      Sylvain Jean
      last edited by Sylvain Jean

      I want to show on screen a long text already program in my lines, but want to make return to get a better view an understanding for the user.

      What are the expression that I have to get in my line to get those force return line?

      example of line
      <property name=“ServerLoginConfirmationText” value=“For in game information, be please to ask question to ingame admin, those are; XXXXX, YYYY, ZZZZZ” />

      What I want to be show
      For in game information, be please to ask question to ingame admin,
      those are;
      XXXXX,
      YYYY,
      ZZZZZ

      How do i edit my line to get result?

      PeterJonesP CoisesC mkupperM 3 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Sylvain Jean
        last edited by

        @Sylvain-Jean said in Line return:

        What are the expression that I have to get in my line to get those force return line?

        In the Replace With field, \r\n will insert a Windows newline sequence (CRLF) when you are in Search Mode > Regular Expression, so you would have to craft your Find What in such a manner that it finds the right spots to insert the newline sequence. I cannot tell from your example how to decide where the newline goes, but this should get you started.

        Also, please note, you appear to be trying to edit XML with regular expressions, which is a bad idea.

        ----

        Useful References

        • Please Read Before Posting
        • Template for Search/Replace Questions
        • Formatting Forum Posts
        • Notepad++ Online User Manual: Searching/Regex
        • FAQ: Where to find other regular expressions (regex) documentation
        1 Reply Last reply Reply Quote 3
        • CoisesC
          Coises @Sylvain Jean
          last edited by

          @Sylvain-Jean said in Line return:

          I want to show on screen a long text already program in my lines, but want to make return to get a better view an understanding for the user.

          What are the expression that I have to get in my line to get those force return line?

          If I understand your question, this depends entirely on what program is displaying the text to the user. It really has nothing to do with Notepad++.

          I don’t want to encourage going off-topic for this forum, but perhaps if you could tell us what program is being used to display this data, we could point you toward someplace that might be able to help.

          1 Reply Last reply Reply Quote 3
          • mkupperM
            mkupper @Sylvain Jean
            last edited by

            @Sylvain-Jean, is this a Notepad++ question or a regular expression question? This forum’s focus is supporting the Notepad++ editor, and at times people have questions about Notepad++'s search/replace feature.

            If you are using using Notepad++ then you may be interested in the Generic Regex: Replacing in a specific zone of text article.

            However, I personally don’t think what you want can be done in a single search replace as you want to do several things.

            1. You want search/replace the string <property name="ServerLoginConfirmationText" value=" with nothing.
            2. You want to keep the string For in game information, be please to ask question to ingame admin
            3. You want to replace the comma-space that is after admin at the end of the previous string with a comma-newline.
            4. You then want to replace the spaces that follow comma or semicolon with a newline up until the " />
            5. You want to replace the " /> with nothing.

            Before proceeding further, I suspect you should think more carefully about what you are asking for. That’s because while it can be done in two steps they are are rather specific to the example data you had provided:

            Search: (?-i)(?:<property name="ServerLoginConfirmationText" value="|" />)
            Replace: (nothing)

            The string is now: For in game information, be please to ask question to ingame admin, those are; XXXXX, YYYY, ZZZZZ and so we then deal with that using:

            Search: (?-is)(?-i:For in game information, be please to ask question to ingame admin|(?!\A)\G).*?\K(?-i:(?<=[,;])\x20)
            Replace: \r\n

            The latter expression is straight from the article I linked to above using (?-s)(?-i:BSR|(?!\A)\G).*?\K(?-i:FR) where

            • BSR is For in game information, be please to ask question to ingame admin
            • FR is (?<=[,;])\x20

            The BSR is longer than you’d think as you wanted to preserve the comma-space in that string.

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