I am trying to write a regular expression for mysql in PHP to find (at least one occurrence) exactly 3 of the same characters in a string, but not 4 (or more) of the same.
For example, for "000" I want to find:
- 0 ////// 0/00 / LS /////// 000
- 000 //// 0/00 / LS //////////
- 0 ////// 0/00 / LS //// 000 ///
- 0 ////// 000 // LS ////// 000 /
- 0 ////// 000 // LS // 00000000
but not:
- 0 ////// 000 0 / LS //////////
- 0 ////// 0 000 / LS //////////
- 0 ///// 0 000 0 / LS //////////
, , , 3 , , 0, 0 000000
REGEXP '[^0]*[0{3}][^0]*'
.