Regexs in Ruby getting filename

Posted by user1290757 on Stack Overflow See other posts from Stack Overflow or by user1290757
Published on 2012-03-26T23:26:44Z Indexed on 2012/03/26 23:29 UTC
Read the original article Hit count: 228

Filed under:
|

i am extracting file names of html files using line: filename = File.basename(input_filename, ".*") which currently prints full file name excluding .html extension

All files are stored in the form of http^x.x.edu^1^2 all file names begin with http^ and contain edu^ what i want is to extract 2 (which changes) but it is always the second element after .edu I have attempted destructive gsub! but i m weak with regular expressions.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about regex