I'm new to java programming and have been thrown into some code at work. I have a file to work with.
The file name used to be just filename.111, but was recently changed to 2013191filename.111. We have a java script that drops the word filename and just leave the ".111". Now I need to drop the "2013191filename". Only problem is, the 2013191 changes, so tomorrow the filename will be 2013192, then 2013193 ect ect....
The regular expression .*[.] matches any string of characters up to and including a period. Replacing what that RE matches with an empty string should just leave you with the characters following the period in your input string.
REs aren't limited to or "special" in Java. This is a Basic Regular Expression that will work in any utility that processes regular expressions including, but not limited to: awk, ed, ex, grep, java, sed, vi, ...
Learn how to write regular expressions and they will help you with a lot of programming tasks.
I have another issue where this may help as well. Before this correction, a bunch of files got processed and renamed incorrectly. So now, I have to go back and correct the filenames (about 400 of them).
But I'll post this question in the Shell Scripting section.