{"record":{"id":"d156019d0b488a6b","repo":"apache/druid","slug":"incorrect-regex-s-no-match-found-d15601","errorCode":null,"errorMessage":"Incorrect Regex: %s . No match found.","messagePattern":"Incorrect Regex: (.+?) \\. No match found\\.","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/java/util/common/parsers/RegexParser.java","lineNumber":94,"sourceCode":"  public RegexParser(\n      final String pattern,\n      final Optional<String> listDelimiter,\n      final Iterable<String> fieldNames\n  )\n  {\n    this(pattern, listDelimiter);\n\n    setFieldNames(fieldNames);\n  }\n\n  @Override\n  public Map<String, Object> parseToMap(String input)\n  {\n    try {\n      final Matcher matcher = compiled.matcher(input);\n\n      if (!matcher.matches()) {\n        throw new ParseException(input, \"Incorrect Regex: %s . No match found.\", pattern);\n      }\n\n      List<String> values = new ArrayList<>();\n      for (int i = 1; i <= matcher.groupCount(); i++) {\n        values.add(matcher.group(i));\n      }\n\n      if (fieldNames == null) {\n        setFieldNames(ParserUtils.generateFieldNames(values.size()));\n      }\n\n      return Utils.zipMapPartial(fieldNames, Iterables.transform(values, valueFunction));\n    }\n    catch (Exception e) {\n      throw new ParseException(input, e, \"Unable to parse row [%s]\", input);\n    }\n  }\n","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/java/util/common/parsers/RegexParser.java#L76-L112","documentation":"RegexParser.parseToMap applies the configured regex to an input row using Matcher.matches(), which requires the whole string to match. If the pattern does not match the entire input, a ParseException with 'Incorrect Regex: <pattern> . No match found.' is thrown. This signals that the row content does not conform to the expected delimited/regex structure.","triggerScenarios":"Calling parseToMap(String) with input that does not fully match the pattern set via setPattern/findPattern; also any time the compiled matcher's matches() returns false.","commonSituations":"Ingesting log lines whose format drifted from the configured regex; pattern written with find() semantics in mind (partial match) instead of matches() (full match); rows containing unescaped characters or optional fields absent; wrong parser chosen for TSV/CSV data.","solutions":["Verify the regex matches the ENTIRE line; anchor it or wrap with .* where appropriate (e.g. \".*?(\\\\d+)\\\\s+.*\") since matches() is used","Test the pattern against a representative sample row with Matcher.matches() before configuring ingestion","Fix or regenerate the malformed input rows, or filter/skip them before parsing","If only part of the line should match, switch ingestion to a parser that uses find()-style matching or preprocess the input"],"exampleFix":"// before\nparser.setPattern(\"(\\\\w+) (\\\\d+)\"); // line: \"user 42 extra\"\nMap<String,Object> row = parser.parseToMap(\"user 42 extra\"); // throws\n// after\nparser.setPattern(\"(\\\\w+) (\\\\d+).*\");\nMap<String,Object> row = parser.parseToMap(\"user 42 extra\"); // OK","handlingStrategy":"validation","validationCode":"final java.util.regex.Pattern p = java.util.regex.Pattern.compile(pattern);\nif (!p.matcher(sampleLine).matches()) {\n  throw new IllegalArgumentException(\"Pattern does not match sample line: \" + sampleLine);\n}","typeGuard":"boolean rowMatches(Pattern p, String line) {\n  return line != null && p != null && p.matcher(line).matches();\n}","tryCatchPattern":"try {\n  return parser.parseToMap(line);\n} catch (ParseException e) {\n  log.warn(\"Unparseable row [%s]: %s\", line, e.getMessage());\n  return Collections.emptyMap();\n}","preventionTips":["Remember matches() requires a FULL-line match; anchor patterns accordingly","Test the regex against representative sample rows before configuring ingestion","Validate patterns with Pattern.compile up front to fail fast on syntax errors","Monitor ParseException rates and alert on sudden increases (input drift)"],"tags":["regex","parsing","druid"],"backgroundTag":"invalid-regex-pattern","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}