Trying to get a regex for any string that matches view.php with the GET variable file with as value [a-zA-Z0-9_]*. FYI, I need to rewrite this URL to /file/value
What I did but didn’t work: ^view.php\?.*?(&|\?)file=([a-zA-Z0-9_]*).*$
What does work?
Leading
^means your entire string begins with view.php, which is probably not true.Also in your regex your assume, that
fileis the last GETetc.
This regex should match get value for
filein any string