Welcome Guest, Not a member yet? Register   Sign In
The URI you submitted has disallowed characters: $1
#7

[eluser]BrianDHall[/eluser]
For fun, lets break down why that works with the regex: ([a-z_A-Z]+/[0-9]+.+)

First, the parens captures what matches inside so we can use in variables, such as $1, $2, etc.

Next: [a-z_A-Z]+

Inside the brackets we say "match a-z (lower-case), underscore, or A-Z (uppercase)", and then with plus as say "at least 1 or more instances of any of these, please". So in a string like "test/testing", the regex alone would match 'test' or 'testing' just as well.

But we don't stop there. We ask for a '/' all by itself, then we ask for: [0-9]+

That means "any number 0-9, please" with the + meaning "at least 1 or more instances, thanks".

Finally: .+

The dot means "OK, go ahead and capture Everything after, I don't care what it is, whatever", and the plus makes it "greedy", meaning "everything you have, please! nothing, something, one thing, a million things, I'll take it!" - because the dot loves everything and everyone.

If this route matches something before some other route matches something (it goes in order of definition, top of file to bottom), everything inside the parens becomes available to you as $1 as it is what was caught by the regex.


Messages In This Thread
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 01:08 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 01:35 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 02:09 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 02:35 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 02:48 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 03:29 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 03:37 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 03:46 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 03:55 PM
The URI you submitted has disallowed characters: $1 - by El Forum - 10-27-2009, 03:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB