So I have these Regex Objs in JS
const itemModelRegEx = new RegExp
(/^(item1|item2|item3|item4)(-)(\d{4}((0[1-9])|(1[0-2]))(0[1-9]|[1-2][0-9]|3[0-1]))(?:.*)/, 'i',);
const dateRegex = new RegExp(/(20\d{2})([0-1]\d)([0-3]\d)/i);
currently I am trying to convert them to Java as such:
String regexOne = "^(item1|item2|item3|item4)(-)(\d{4}((0[1-9])|(1[0-2]))(0[1-9]|[1-2][0-9]|3[0-1]))(?:.*)"
Pattern itemModelRegEx = Pattern.compile(regexOne);
Pattern dateRegex = Pattern.compile("(20\d{2})([0-1]\d)([0-3]\d)");
However, this doesn't seem to be correct. What would a proper conversion here look like? Would the same wildcards apply? I removed the "/" from start and end but should the "\" in the pattern be set-up differently?
[0-1]as[01]