#!/bin/bashs='../foo../../foo../../../foo'sed -E 's,(\.\./)+foo,foo1,' <<< "$s"
Standard input is empty
foo1 foo1 foo1
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!