Neither basic nor extended Posix/GNU regex recognizes the non-greedy quantifier; you need a later regex. Fortunately, Perl regex for this context is pretty easy to get:
perl -pe 's|(http://.*?/).*|\1|'
More Related Contents:
- Is it possible to escape regex metacharacters reliably with sed
- Greedy vs. Reluctant vs. Possessive Qualifiers
- What is the difference between .*? and .* regular expressions?
- RE error: illegal byte sequence on Mac OS X
- How do you debug a regex? [closed]
- How to extract text from a string using sed?
- Using sed to delete all lines between two matching patterns
- Why doesn’t `\d` work in regular expressions in sed? [duplicate]
- Regular expression – PCRE does not support \L, \l, \N, \P,
- Verbs that act after backtracking and failure
- sed one-liner to convert all uppercase to lowercase?
- Unicode Regex; Invalid XML characters
- sed join lines together
- How to replace a whole line with sed?
- Why is sed not recognizing \t as a tab?
- Why can’t you use repetition quantifiers in zero-width look behind assertions?
- Does lookbehind work in sed?
- Insert linefeed in sed (Mac OS X)
- Replace newlines with literal \n
- Replace a word with multiple lines using sed?
- replace a unknown string between two known strings with sed
- Question marks in regular expressions
- Why does sed require 3 backslashes for a regular backslash?
- Using sed and grep/egrep to search and replace
- Invert match with regexp [duplicate]
- How to change date format in sed?
- Replace all whitespace with a line break/paragraph mark to make a word list
- How to do a non-greedy match in grep?
- Shortest match in regex from end
- Whats the difference between sed -E and sed -e