Fixed: Non greedy regex matching in sed? #it #programming #answer
Fixed: Non greedy regex matching in sed? #it #programmingĀ #answer
Non greedy regex matching in sed?
Iām trying to use sed to clean up lines of URLs to extract just the domain..
So from:
http://www.suepearson.co.uk/product/174/71/3816/
I want:
http://www.suepearson.co.uk/
(either with or without the trainling slash, it doesnāt matter)
I have tried:
sed 's|\(http:\/\/.*?\/\).*|\1|'
and (escaping the non greedy quantifier)
sed 's|\(http:\/\/.*\?\/\).*|\1|'
buā¦
View On WordPress













