Community
    • Login

    Regex help using find for the first 15 characters only.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 749 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.
    • Caner AkC
      Caner Ak
      last edited by

      Is there a way to create an expression that will only look at the first 15 characters from the start of a line?
      Example:

      12345600000001U etc
      12345600000002T etc
      12345600000003U etc.
      12345600000004T etc

      In this case I only want the rows with “U” at the end of the first 15 characters of the string (because there could be “U” after the first 15 characters in the rows containing “T”'s).

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Caner Ak
        last edited by PeterJones

        @Caner-Ak ,

        Yes, using single character matches, quantifiers/multiplying operators and anchors: For example, ^.{14}U will only match “start-of-line, then 14 of any character, then a U”.

        Note: When using . to match any character, make sure you have the correct state of . Matches Newline or use the equivalent search modifier (?-s)/(?s) in the regex.

        ----

        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
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors