find group of machting characters
-
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 200001742340020110400201914002019101this 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.*40020191But 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 -
I certainly might be inclined to try
(?-s)(\d{8}).*?\1 -
@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
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