Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
we have files that we are reading and trying to rename in some scenarios and below code works..
files --
String regex = "[0-9]{4}[_-][0-9]{2}[_-][0-9]{2}"; java.util.regex.Matcher m = java.util.regex.Pattern.compile(regex).matcher(context.CurrentFileName); if (m.find()) { context.CurrentFileDate = "datefolder="+(m.group(0).trim().substring(0,4))+"-"+(m.group(0).trim().substring(5,7))+"-"+(m.group(0).trim().substring(8,10)); } else { context.CurrentFileDate = "datefolder="+formattedDate; }
now we are getting interesting file-names and needed some help how i can modify above if-else statement so it can work.
any suggestion how to modify above if-else statement ? since matcher in java can only find based on regex, in what i tried so far .