R
RichardOnRails
Hi,
I just installed ruby 1.9.0 (2008-07-25 revision 18217) [i386-mswin32]
in order get Ruby look-behind functionality. I expected the following
snippet to insert a substring, but it did nothing:
Ruby:
printf("item = \"%s\"\n", item) if $DEBUG
printf("item basename = \"%s\"\n", File.basename(item)) if $DEBUG
item.sub!( /(?<=Investment-\d\d\.\d\d)(?=-)/, '.2008')
printf("new item base = \"%s\"\n", File.basename(item)) if $DEBUG
Output:
item = "K:\___Investment\2008-Trades\Investments-06.19-2100.xls"
item basename = "Investments-06.19-2100.xls"
new item base = "Investments-06.19-2100.xls"
Expected:
new item base = "Investments-06.19.2008-2100.xls"
Any idea of what's wrong?
TIA,
Richard
I just installed ruby 1.9.0 (2008-07-25 revision 18217) [i386-mswin32]
in order get Ruby look-behind functionality. I expected the following
snippet to insert a substring, but it did nothing:
Ruby:
printf("item = \"%s\"\n", item) if $DEBUG
printf("item basename = \"%s\"\n", File.basename(item)) if $DEBUG
item.sub!( /(?<=Investment-\d\d\.\d\d)(?=-)/, '.2008')
printf("new item base = \"%s\"\n", File.basename(item)) if $DEBUG
Output:
item = "K:\___Investment\2008-Trades\Investments-06.19-2100.xls"
item basename = "Investments-06.19-2100.xls"
new item base = "Investments-06.19-2100.xls"
Expected:
new item base = "Investments-06.19.2008-2100.xls"
Any idea of what's wrong?
TIA,
Richard