string match inside a var ? How to
Hi, i currently have a problem which i cant resolve and i cant seem to find a solution (i actually not sure what to look for). My jquery level is medium-low and im trying to take it to a higher level right now.
I have a var which holds a href value. However i only need part of the string.
var fileurl would be for example : http://somewebsite.com/admin.php?page=browsing&action=download&selfile=/home/website/file.jpg&_code=9999999999
I know this structure in the href wont change. So i need to remove eveything before selfile= (included), and everything after &_code= (included aswell)
the only important information i need is: /home/website/file.jpg
Im trying to use, for example:
- fileurl = fileurl.replace( /?.*/ , '' );
But i cant seem to get the correct expression. Can anyone please help me?
Thanks in advance for any help!