• Login
Community
  • Login

Regex help using find for the first 15 characters only.

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
2 Posts 2 Posters 1.1k 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.
  • C
    Caner Ak
    last edited by Nov 3, 2023, 1:48 PM

    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).

    P 1 Reply Last reply Nov 3, 2023, 2:11 PM Reply Quote 0
    • P
      PeterJones @Caner Ak
      last edited by PeterJones Nov 3, 2023, 2:12 PM Nov 3, 2023, 2:11 PM

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