• Login
Community
  • Login

find group of machting characters

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 232 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
    bowoo king
    last edited by May 15, 2020, 12:41 PM

    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

    A 2 Replies Last reply May 15, 2020, 12:50 PM Reply Quote 0
    • A
      Alan Kilborn @bowoo king
      last edited by May 15, 2020, 12:50 PM

      @bowoo-king

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

      1 Reply Last reply Reply Quote 4
      • A
        Alan Kilborn @bowoo king
        last edited by May 15, 2020, 1:17 PM

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