[
https://issues.apache.org/jira/browse/IO-886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18057091#comment-18057091
]
Gary D. Gregory commented on IO-886:
------------------------------------
{quote}In practice, all file systems have single-character separators AFAIK, so
it's more a theoretical issue.
{quote}
Note: The API Java {{java.nio.file.FileSystem.getSeparator()}} returns a
String, not a {{{}char{}}}.
> PathUtils.RelativeSortedPaths.extractKey uses incorrect regular expression
> --------------------------------------------------------------------------
>
> Key: IO-886
> URL: https://issues.apache.org/jira/browse/IO-886
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 2.21.0
> Reporter: Peter De Maeyer
> Priority: Trivial
> Attachments: image-2026-02-07-14-27-32-345.png
>
>
> {{PathUtils.RelativeSortedPaths.extractKey}} uses a regular expression with
> an escape character to escape a single character separator, but separator is
> a string so in theory can be multiple characters. IntelliJ gives an error on
> this (the compiler doesn't).
> !image-2026-02-07-14-27-32-345.png!
> In practice, all file systems have single-character separators AFAIK, so it's
> more a theoretical issue.
> I suggest to just remove the regular expression, there is no need for it.
> Just use an exact string-matching replacement instead.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)