• Login
Community
  • Login

How to bookmark lines with certain characters in certain positions

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 2 Posters 447 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.
  • B
    Brian Y.
    last edited by Mar 4, 2024, 2:20 PM

    Re: How to delete lines with missing characters in certain positions

    Thanks to this group, I know how to bookmark and then delete lines with missing characters in certain positions. Is there a way to bookmark lines that have certain characters in certain positions? For example, I’m trying to bookmark all lines that have an N in position 39 and a D in position 40.

    P 1 Reply Last reply Mar 4, 2024, 2:39 PM Reply Quote 0
    • P
      PeterJones @Brian Y.
      last edited by PeterJones Mar 4, 2024, 2:39 PM Mar 4, 2024, 2:39 PM

      @Brian-Y ,

      It’s the same idea as in the post you linked to. The post you linked to wanted to find a space in the 18th character, so it looked for 17 of any character and then one space using ^.{18}\s

      You want ND in positions 39-40, so you want to look for 38 of any character followed by ND, thus ^.{38}ND

      ----

      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
      • B
        Brian Y.
        last edited by Mar 4, 2024, 3:24 PM

        Ty for the quick reply…that gives me anything that has an N in position 39. Is there a way to test both positions within the same formula? Position 39 has to be N and Position 40 has to be D.

        P 1 Reply Last reply Mar 4, 2024, 4:13 PM Reply Quote 0
        • P
          PeterJones @Brian Y.
          last edited by PeterJones Mar 4, 2024, 4:13 PM Mar 4, 2024, 4:13 PM

          @Brian-Y said in How to bookmark lines with certain characters in certain positions:

          that gives me anything that has an N in position 39. Is there a way to test both positions within the same formula? P

          The regex I gave does only match if N is 39 and D in 40, as shown in this screenshot below.

          a5a7d6ae-63eb-475c-b570-8313e33ef3e5-image.png

          1 Reply Last reply Reply Quote 1
          • B
            Brian Y.
            last edited by Mar 4, 2024, 5:06 PM

            Gotcha. Thanks so much, that will really help.

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