java - Regex for checking file extensions and untitled -
i have next regex: (?s)(?i)\.(pdf|doc|docx|xls)|untitled
checks filetype extensions or word untitled.
@transient private static final pattern titlepattern = pattern.compile("(?s)(?i)\\.(pdf|doc|docx|xls)$|untitled");
now, tests failing because of text such .document
or .docblah
.
how modify regex stop regex matching characters after filetype extensions?
you remove $
i.e (?s)(?i)\.(pdf|doc|docx|xls)|untitled
java regex pattern-matching
No comments:
Post a Comment