How can I make this apply to a whole group? For example instead of
only making tutorials/61 go to the proper URL, making anything that is
just “/tutorials/SOMETHING” go to the proper URL?
How can I make this apply to a whole group? For example instead of
only making tutorials/61 go to the proper URL, making anything that is
just “/tutorials/SOMETHING” go to the proper URL?
I think thats where it would go. As for regular expressions, I don’t
have a clue where it is in the example, Im really not amazingly good
in RoR and I would very much appreciate some help with figuring it
out…
As for regular expressions, I don’t
have a clue where it is in the example, Im really not amazingly good
in RoR
What programming language do you know? Because if this line:
r301 %r{/wiki/(\w+)_\w+}, '/$1'
:: doesn’t jump out at you as a regular expression – certainly when
contrasted with the other example lines – then I suspect you need to
just plain read up on RegEx in general…
I program in many languages, and that does not stand out to me.
I know C++, Java, CSS, HTML, Lua, and Visual Basic; and that doesn’t
stand out to me. I assume that this is from a whole different category
of programming/scripting languages; of which I don’t know.
Could you please explain to me how it works, and how I can use it in
my personal scenario?
Look at your app and see where you find ‘config.gem’ entries. Or
read about using Rack middleware. It should be pretty obvious
How can I make this apply to a whole group?
And you’ve already gotten that answer – use a regular expression.
If you don’t recognize that your own example includes one, you’re
probably in deep bandini already
I program in many languages, and that does not stand out to me.
I know C++, Java, CSS, HTML, Lua, and Visual Basic; and that doesn’t
stand out to me.
CSS and HTML aren’t programming languages. Â C++ and Java don’t have much
regex support. Â I don’t know Lua or VB, so can’t comment.Â
I assume that this is from a whole different category
of programming/scripting languages; of which I don’t know.
To some extent.Â
Â
Could you please explain to me how it works, and how I can use it in
my personal scenario?
That would be a bit of a waste of time until you go read the Pickaxe
Book’s explanation of regular expressions. Â You’ve asked a huge number
of elementary questions here that could have been answered by reading
the docs.Â
I program in many languages, and that does not stand out to me.
I know C++, Java, CSS, HTML, Lua, and Visual Basic; and that doesn’t
stand out to me. I assume that this is from a whole different category
of programming/scripting languages; of which I don’t know.
Could you please explain to me how it works, and how I can use it in
my personal scenario?
I think you need to just learn something about regular expressions.
/wiki/(\w+)_\w+
“\w A word character: [a-zA-Z_0-9]”
The above definition is taken from the API doc for java.util.regex
which also uses the same ‘+’ quantifier and ‘( )’ capture group syntax.
So there’s nothing out of the ordinary here that a little regex study
shouldn’t serve to enlighten…
So I guess ill want something like this: r301 %r{/tutorials/(\w+)}, ‘/
$1’
But instead of using the first unknown word variable (as “/$1” would
refer to (as far as I know)); I want it to go to my permalinked URL
(http://127.0.0.1:3000/categories/1-css/tutorials/12-test9 ).
I’ve already read this, and still don’t understand.
As I said, it’s using regular expressions, and you need to figure out
how they work. Find a regex tutorial, open up irb and play around.
Then, or even before, use the examples in the Rack::Rewrite docs to
experiment. It’ll take less time to just try it than to compose an
email.
And at least you’ll be able to say “here’s what I want, here’s what I’ve
tried, here are the results”.
I’ve tried, but I can’t figure out how to replace $1 with a permalink
variable thats in ruby on rails. Im pretty sure regex cannot help me
with this, I need to take the permalink value, and use that in the
redirect.
PLEASE JUST TELL ME AND ILL LEARN, I DONT JUST TAKE THE ANSWER AND BE
DONE WITH IT, I LEARN FROM IT.