[Wtr-general] Need Regular Expression help with a URL string
Paul Carvalho
tester.paul at gmail.com
Thu Jan 11 12:54:01 EST 2007
Okay, I give up. I've worked on this for over an hour and I need more
experienced help. (Web searches and book references haven't helped either.)
I have a URL in a string and I'd like to replace part of it but first I need
to find the part that I care about. Here's an example of the string:
web_url = 'http://foo/bar.html'
Now, what I am trying to do is find the *last* forward slash (/) in that
string so that I can then replace everything after it. I am having
difficulty finding that last slash though.
I am trying to use the str[ regexp, int ] function, but I can't seem
figure it out.
Can anyone help me with this regexp? Once I get it I'll figure out what's
the best function for what I need to do. Thanks.
Paul C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070111/8f6fca4d/attachment.html
More information about the Wtr-general
mailing list