Reputation: 605
I have this:
http://server/service/local/repositories/domain/content/name/1.0.0-SNAPSHOT/name2-1.0.0-20161114.174435-142.pom
I would like to take only name2-1.0.0-20161114.174435-142.pom using Regex
I tried something like \/(.)*.pom$
but it selects all caracters starting with the two slashs.
Heeeelp!
Upvotes: 0
Views: 65
Reputation: 56162
You can use this regex: [^\/]+$
https://regex101.com/r/Zn5n6e/1
Upvotes: 2
Reputation: 6374
Try the following expression:
[^\/]+\.pom$
Regex101 demo: https://regex101.com/r/dOg0yi/1
Upvotes: 3
Reputation: 6088
You can try to use Lookaround:
(?=name\w)\V+
Demo: https://regex101.com/r/u1o3yG/2
Upvotes: 2
Reputation: 473
echo "http://server/service/local/repositories/domain/content/name/1.0.0-SNAPSHOT/name2-1.0.0-20161114.174435-142.pom"|sed 's/^.*\/\([^/]*\)$/\1/'
Upvotes: 2