From: Joshua Ballanco Date: 2007-06-07T08:50:53+09:00 Subject: Re: newbie question: deleting all of a string's contents BEF Chad Wells wrote: > That would work great if I was not worried that Youtube would change > their URL scheme (it doesn't seem too likely, given the abundance of > links out there, but should one ever fully count it out?). Not saying > it'll even always have an equals sign in it and then the unique video > indentifier at the end, either, so I guess it doesn't even matter! :-D > > Anyway, thanks everyone!! I am going to give "code = url.sub(/.*=/, > "")" a shot to see how it works for me. > > -C Don't forget, regular expressions in Ruby are objects (...well, yes, everything in Ruby is objects...). So, you could do something like: YOUTUBE_PARSER = Regexp.(/\w+$/) ... url[YOUTUBE_PARSER] That way, if Youtube ever does change their naming scheme, you only have to change one line of code (and that line can be put right up on the top of your listing). Hope that helps a bit! -Josh -- Posted via http://www.ruby-forum.com/.