I think you need to include the regex OR operator:
String[]tokens = pdfName.split("-|\\.");
What you have will match:[DASH followed by DOT together] -.not[DASH or DOT any of them] - or .
-.
-
.
Try this regex "[-.]+". The + after treats consecutive delimiter chars as one. Remove plus if you do not want this.
"[-.]+"
You can use the regex "\W".This matches any non-word character.The required line would be:
String[] tokens=pdfName.split("\\W");