Code Room
Code reviewMediumcr-g301
Subject Regex recompileLevel Mid–Senior~18 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Java method that masks card-like numbers in each log line. It runs on millions of lines per export.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewjava
String maskLine(String line) {    Pattern p = Pattern.compile("\\b\\d{13,16}\\b");    return p.matcher(line).replaceAll("[REDACTED]");}
Run or narrate your approach, then ask the coach.