Community
    • Login

    find group of machting characters

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 228 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.
    • bowoo kingB
      bowoo king
      last edited by

      Hello,

      I would like to use a RegEx to find a group of machting characters

      string example:
      2020-04-30T14:17:41.581Z <PLC0040:[STX/2]4110168 200001742340020110400201914002019101

      this string contains twice : 40020191

      but the value of the characters may vary, so instead of the example the following is also possible 12345678.

      When the group of characters is known i use:

      (?-s)(?i)40020191.*40020191
      

      But now it needs to be more generic. So only looking for a duplication of a group of 8 characters in a string.

      How can i do this?

      Thanks in advance!
      Boris

      Alan KilbornA 2 Replies Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @bowoo king
        last edited by

        @bowoo-king

        I certainly might be inclined to try (?-s)(\d{8}).*?\1

        1 Reply Last reply Reply Quote 4
        • Alan KilbornA
          Alan Kilborn @bowoo king
          last edited by

          @bowoo-king said in find group of machting characters:

          duplication of a group of 8 characters in a string

          The example showed digits so that’s what my solution was tailored to.
          But…
          If it is truly “characters” then this might be more appropriate:
          (?-s)(.{8}).*?\1

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