Welcome Guest, Not a member yet? Register   Sign In
Route Problem(RegEx Issue)
#1

[eluser]ShoeLace1291[/eluser]
So i'm coding a custom forum for a website that I'm making. I have a link that I want to take the user to the last post on a thread page. The uri string looks something like this: forums/The-Board-The-Thread-Is-In/The-Title-Of-The-Thread/123/123#last

Basically #last will take you to an anchor located at the last post of the thread. What I need is a regex that will accept only characters 0-9(any length) plus "#last" only at the end. Any ideas?
#2

[eluser]Mr. Pickle[/eluser]
Couldn't you make it easier for yourself and have the '#last' part in a seperate uri segment:
forums/The-Board-The-Thread-Is-In/The-Title-Of-The-Thread/123/123/#last

Anyway, a regex for your example(any length of numbers > 0 and #last at the end) should look something like this:
[0-9]{1,}#last$
#3

[eluser]sblaas[/eluser]
#<string> isn't in your "request uri" ( received server wise ) so you can't filter / regex / match on it.

I'm not sure if it's possible with htaccess though but i doubt it. #last is just a html anchor.

You can however substract the anchor with javascript so maybe a solution with ajax is something for ya.



[quote author="Mr. Pickle" date="1304427861"]Couldn't you make it easier for yourself and have the '#last' part in a seperate uri segment:
forums/The-Board-The-Thread-Is-In/The-Title-Of-The-Thread/123/123/#last

Anyway, a regex for your example(any length of numbers > 0 and #last at the end) should look something like this:
[0-9]{1,}#last$[/quote]
#4

[eluser]Mr. Pickle[/eluser]
Then there is no problem at all is there.
Just add #last after a / and if you have an html anchor #last in your page your browser will send you there.

So no need for scripting at all then.
#5

[eluser]sblaas[/eluser]
Exactly

[quote author="Mr. Pickle" date="1304430257"]Then there is no problem at all is there.
Just add #last after a / and if you have an html anchor #last in your page your browser will send you there.

So no need for scripting at all then.[/quote]




Theme © iAndrew 2016 - Forum software by © MyBB