I have this htaccess code
RewriteRule ^/([uge])/([^/]+)$ /$1/$2/
But I couldn’t really understand what does [^/]+ do?
I’ve been searching this on Google for awhile, but I couldn’t get what I wanted.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have two basic regex constructs here
Character class
See character classes on regular-expressions.info
[...]is a character class, means this construct matches one character from the class (from inside the square brackets).Your class starts with a
^, that gives the character class a special meaning, its a negated character class ([^...]), means matches anything thats not part of the class.Quantifier
See quantifiers on regular-expressions.info
+is a quantifier, meaning 1 or moreMeaning of your regex
To understand what this is doing you have also to take the next thing into account, the
$at the end. This is an anchor that matches the end of the string.See anchors on regular-expressions.info
so
([^/]+)$matches all characters at the end of the string that are not slashes.Here you can also find a basic tutorial