0

I'm trying to filter a URL using regex and now I have added new portion to the URL so existing regex script won't work.

  location ~ ^/p/(?<secure>[\w\-=]+,\d+)(?<file>/.*)$

I get $secure , $file values, now I need to get $user as well.

Old URL structure:

 /p/uwoT4ccBKjBryHxQNrwRzA,1385726761/test.zip

New URL structure:

 /p/uwoT4ccBKjBryHxQNrwRzA,1385726761,USER/test.zip

I've added ,USER portion to the new URL, how do you do this in regex?

1 Answer 1

1

Try this regex:

location ~ ^/p/(?<secure>[\w\-=]+,\d+),(?<user>[^/]+)(?<file>/.*)$

$secure, $file and $user

Sign up to request clarification or add additional context in comments.

2 Comments

Great, THANKS! btw How do you do it?
, is outside (...) thus it will not be match.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.