Re: a regex

You can split it:

string = 2006%2F10%2Fasdfasdf

year, day, text = string.split(/%2F/)

Should give:

The variables at the beginning are the names you give the different bits
you want out of the string, and you pass the regex or character you want
to split the string with. It’s useful for filenames where you can split
on the .

There is probably a very elegant way of doing this recusively if you
have more than 3 cariables to fish out. ( :

Hope this helps?!


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs