Reputation: 15076
I have the following oneliner:
Download of file /xxx/xxx-xxx/Xxx/Xx_XX/xxx/xxx xxx/Xxxx/xxxx/xxxx.png to /home/ec2-user/xxx/xx/xx/Xxxy/xx_XX_XX/xxx/xxx xxx/XXX/xxxx/Xxx.png failed
How can I match the first /xxx/xxx-xxx/Xxx/Xx_XX/xxx/xxx xxx/Xxxx/xxxx/xxxx.png
?
It will always start with "/
" and always end with .png
. The rest in between can me chars, capitals, numbers, spaces, _ and - (everything). How can I match this regex?
Upvotes: 1
Views: 72
Reputation: 91385
N oneed for lookarounds, use:
/.*?\.png
It finds the match in 55 steps, the other answer matches in 217 steps.
Upvotes: 0
Reputation: 20901
(?<=file ).*(?= to)
yields the wished result. Online
Upvotes: 3