regexnsregularexpression

How to write a regex that matches duplicated words with 5 occurrences?


I want to match the duplicated words which in this instance is GHL_AutoMatchFaulted In this example, there are 5 occurrences which I want to match all 5 otherwise it will not match

GHL_AutoMatchFaulted
GHL_AutoMatchFaulted
GHL_AutoMatchFaulted
GHL_AutoMatchFaulted
GHL_AutoMatchFaulted

Is this possible?

Any help would be much appreciated. Thanks.

Tried almost all from the forum but nothing works.


Solution

  • How about this one: ?

    (GHL_AutoMatchFaulted\s?\n?){5}
    

    As per Regex101:

    Regex101