Thank you Daniele, for your help!! The test example you provided was
very helpful to get me started.

This entry in works:


Mosaic granules  are in subdirectories as follows:


where time varies from 00 to 23 (for every hour)

It took a while to write a regex pattern. It took some time studying
regex rules.

I also tested the pattern on with this test:

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

public class TestPatternExtraction
  public static void main(String[] args)
    String expr="([0-9]{8})(?:/rtma2p5.)(t[0-9]{2}z)";
    //String expr="(.*[0-9]{8}.*t[0-9]{2}z.*)";
    String name=
    Pattern regex = Pattern.compile(expr);
    Matcher regexMatcher = regex.matcher(name);
    while (regexMatcher.find()) {
        for (int i = 1; i <= regexMatcher.groupCount(); i++) {
            System.out.println("matched text: " +;
            System.out.println("match start: " + regexMatcher.start(i));
            System.out.println("match end: " + regexMatcher.end(i));
      }  catch (PatternSyntaxException ex) {
         // Syntax error in the regular expression
      }//end try
   }//end while
}//end main

This list conversation was also helpful:

As well as firing up Eclipse and tracing through the code.

Kind regards,

On 8/14/19, Daniele Romagnoli <> wrote:
> Hi Alexander,
> you may combine custom *format *and *fullPath* parameter.
> There is an example in the GeoTools TimestampFileNameExtractorTest:
> I'm not very familiar with regex so I cannot help you too much with that
> part. I always have to check the rules, each time I need a complex regex,
> which doesn't occur very often.
> Once you have identified your regex, you can use the propertiesCollector
> with this String for your file
> *rtma2p5.20190731/rtma2p5.t00z.2dvaranl_ndfd.grb2_wexp*:
> "regex=yourmatchingregex,format=yyyyMMdd't'HH'z',fullPath=true"
> Please, let us know.
> Regards,
> Daniele

Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
- Earning your support instead of buying it, but Ian Turton:
- The GeoServer user list posting guidelines:

If you want to request a feature or an improvement, also see this:

Reply via email to