in reply to Regex - substitute

What happens is that the regular expression will start searching the first position of the string and attempt to match o and not finding an o it will try the other alternative at this position. The * after the o gives it the option of matching nothing. (which it does). And, since it has found a match it replaces it with an e. Regular expressions try all the possible alternatives at a position in a string before moving on to the next position (left most first). so it never reaches the oo part as it can match nothing much earlier.

-enlil