Based on updates from OP.
Try this regex string:
(\w{3,})(?=.+\1)
This will find repeating words that is at least 3 char long or more disregards spacing.
private bool CheckForRepeating(string text)
{
return System.Text.RegularExpressions.Regex.IsMatch(text, @"(\w{3,})(?=.+\1)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
}
bool test1 = CheckForRepeating("copythiscode");
bool test2 = CheckForRepeating("copythiscodethisistext");
You can do something like
bool test3 = CheckForRepeating(textbox1.Text + textbox2.Text);
If there is any repeating words from textbox1 in textbox2, this should make test3 = true.
----
You what to play with this regex string:
(\w)\1{3}
It finds any alphanumeric with exact 4 repeating char.
Check out this great tool
Expresso[
^].
You can make a method that do a check like this.
private bool CheckForRepeating(string text)
{
return System.Text.RegularExpressions.Regex.IsMatch(text, @"(\w)\1{3}");
}
bool test1 = CheckForRepeating("password");
bool test2 = CheckForRepeating("paaaassword");