Match all repeated ../
prefixes from the beginning and replace the rest with nothing:
s#^((\.\./)*).*$#\1#g
with extended regular expressions, or with basic regular expressions:
s#^\(\(\.\./\)*\).*$#\1#g
^
matches beginning of line
(\.\./)
matches ../
*
repeats 0 or more times
.*$
matches the rest until the end of line
\1
references the first capturing group match
BUT this is probably achieved easier with grep
instead of sed, since you do not need to do the replacing (so likely a bit faster too):
egrep -o '^(\.\./)*'
-o
prints only the matching portion of the line.