Community
    • Login

    find group of machting characters

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 448 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 Offline
      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 Offline
        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 Offline
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors