<p>I need to find two adjacent repeating digits in a string and replace with a single one. How to do this in Java. Some examples:</p>

<p>123345 should be 12345
 77433211 should be 74321</p>

using a regex:
```
```
var myString='123345'
myString.replace(/([0-9])\1/g,'$1')
```
```
that will match exactly 2 repeats.
```
```
'123334'.replace(/([0-9])\1+/g,'$1')
```
```