Forum Discussion
TheInvoker
4 years agoFrequent Visitor
How to extract a pathname from url text?
I have a table with a column for different urls like these / /person /person?name=xyz /person/123 /person/123?name=xyz How can I extract it so it makes a new column like / /person /...
- 4 years ago
I figured it out. First I find position of ? if exists and remove everything from it onwards.
Then I find last index of "/", and get the substring from that+1 to the end, and check if thats a number.
If it is, I get the substring from start to the above index-1, else use the above string.
TheInvoker
4 years agoFrequent Visitor
I figured it out. First I find position of ? if exists and remove everything from it onwards.
Then I find last index of "/", and get the substring from that+1 to the end, and check if thats a number.
If it is, I get the substring from start to the above index-1, else use the above string.