Reputation: 1
I need solution fro this:
/Women/Dresses/Short-sleeved-Peplum-Dress/p/8503311?utm_extID=Dec10
I need to extract data between /p/ and ? i,e 8503311 total len of this line is 67 but if differs not fixed
I tried by using find function not able get solution
Upvotes: 0
Views: 71
Reputation: 59450
Assuming the data string is in A1, this should return everything between, but not including, the first instance of /p/
and the first ?
thereafter:
=MID(A1,FIND("/p/",A1)+3,FIND("?",MID(A1,FIND("/p/",A1)+4,LEN(A1))))
Upvotes: 0
Reputation: 19727
if it's always after p/
and the length of number is fixed (in your example = 7), this should work:
=MID(A1,SEARCH("p/",A1)+2,7)
This is assuming data in A1
.
Upvotes: 1
Reputation: 425
should be like:
import re
x = '/Women/Dresses/Short-sleeved-Peplum-Dress/p/8503311?utm_extID=Dec10'
re.search('(?<=/p/)\d+',x).group()
Upvotes: 0