Skip to main content
Inspiring
May 22, 2008
Answered

Problem using REFind() to catch repeating characters

  • May 22, 2008
  • 1 reply
  • 359 views
I've written the attached code to catch strings with characters that repeat at least 3 times. However, the regular expression does not seem to working correctly - both REFind() functions return 0. Can somebody assist me? I'm kinda new to RegEx.

Thanks.
This topic has been closed for replies.
Correct answer ericbelair
Well, I think I found the solution to my problem. Don't know how to explain it, but it works. I think because I am backtracking to find repeating characters, I need to find occurrences of 2 repeating characters, since the third is the backtracked character.

See attached solution. The alphanumeric check returns "8" (the first "P") and the non-alphanumeric check returns "3" (the first "%").

1 reply

ericbelairAuthorCorrect answer
Inspiring
May 22, 2008
Well, I think I found the solution to my problem. Don't know how to explain it, but it works. I think because I am backtracking to find repeating characters, I need to find occurrences of 2 repeating characters, since the third is the backtracked character.

See attached solution. The alphanumeric check returns "8" (the first "P") and the non-alphanumeric check returns "3" (the first "%").