Skip to main content
Inspiring
November 29, 2010
Question

Is this a RegExp bug??? Matching double letters inside words...

  • November 29, 2010
  • 1 reply
  • 461 views

I'm trying to match double letters inside words, excluding ones that begin or end a word.  I'm running into a problem matching \B at the end of a line.

example:

My RegExp is /\Bdd\B/gi

String is "dda adda add add"

This will match twice, the dd in the 2nd word, and the dd in the 4th word.  Why is it matching the 4th word??

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
December 24, 2010

It matches only once. Make sure there are no other characters in the end of your string.