diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java index 8b5f0bbdcc..325ec1540a 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java @@ -407,14 +407,18 @@ public class BinaryMapIndexReader { } String ls = rg.get(0); if (ls.lastIndexOf('_') != -1) { - if (ls.matches(".*([0-9]+_*){3}\\.obf")) { - Pattern osmDiffDateEnding = Pattern.compile("_([0-9]+_*){3}\\.obf"); + if (ls.matches("([a-zA-Z-]+_)+([0-9]+_){2}[0-9]+\\.obf")) { + Pattern osmDiffDateEnding = Pattern.compile("_([0-9]+_){2}[0-9]+\\.obf"); Matcher m = osmDiffDateEnding.matcher(ls); if (m.find()) { ls = ls.substring(0, m.start()); + if (ls.lastIndexOf('_') != -1) { + return ls.substring(0, ls.lastIndexOf('_')).replace('_', ' '); + } else { + return ls; + } + } - return ls.substring(0, ls.lastIndexOf('_')).replace('_', ' '); - } else { if (ls.contains(".")) { ls = ls.substring(0, ls.indexOf(".")); diff --git a/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java b/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java index e0eac2a796..d9da250e28 100644 --- a/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java +++ b/OsmAnd-java/src/net/osmand/search/core/SearchPhrase.java @@ -587,7 +587,8 @@ public class SearchPhrase { Iterator it = indexes.iterator(); while (it.hasNext()) { BinaryMapIndexReader r = it.next(); - if (r.getFile().getName().matches(".*([0-9]+_*){3}\\.obf")) { + String filename = r.getFile().getName(); + if (filename.matches("([a-zA-Z-]+_)+([0-9]+_){2}[0-9]+\\.obf")) { String currRegionName = r.getRegionName(); if (result.containsKey(currRegionName)) { result.get(currRegionName).add(r);