Class GlobbingPathHelper


  • public class GlobbingPathHelper
    extends Object
    • Constructor Detail

      • GlobbingPathHelper

        public GlobbingPathHelper()
    • Method Detail

      • globPathAsRegex

        public static String globPathAsRegex​(String pathWithGlobs)
        Converts the provided path containing glob characters * and ** into a regular expression. The definition matches that of the GlobbingPathFilter with the addition that this conversion also supports sub-paths which do not start with a /.

        The rules are:

        • leading ** matches /foo and bar
        • leading /** matches /foo but not bar
        • intermittent ** matches zero or any number of path elements
        • trailing ** matches anything not ending with a /
        • single * matches anything except /
        • ? is not a special character
        • anything not a star is wrapped into \Q...\E pairs
        Parameters:
        pathWithGlobs - path that can contain * and **
        Returns:
        a regular expression
        See Also:
        GlobbingPathFilter