Question: How can I find occurences of same subsequent characters in a string with a regular expression or function?

Example:

> 
> I am l​**ee**​t and I have a thr​**ee**​ pi​**zz**​as. That n​**oo**​b right there has only one pi​**zz**​a. P​**oo**​r boy.
> 
> 
>

Answer: 
You can use a [backreference](http://www.regular-expressions.info/brackets.html#usebackrefinregex):

```
/(.)\1/

```

Change `\1` to `\1+` if you want to find sequences of length two or more.

Note that the syntax can vary depending on the regular expression engine you are using.
Not sure which version of regex you're working with, but for `egrep`, this works:

```
egrep '(.)\1' < file

```

That will show all lines that have two of some character in a row. If you want just letters:

```
egrep `([A-Za-z])\1' < file

```

would work.