I have a string that I'm matching on, and using the results to generate a custom error message from the one provided. I have a group that should match on values inside a repeating non-matching group. Code as follows:
String to search:
Element '{http://example.com/dev}emailCredit' is unexpected according to content model of parent element '{http://example.com/dev}promotion'.
Expecting: {http://example.com/dev}programmingCredit, {http://example.com/dev}cfppCredit.
/^Element '.*' is unexpected according to content model of parent element '.*'.\s*Expecting:(?: {[\w:\/\-]*}(\w*)[,]?)+\w*\.\s*$/
var reqReg = new RegExp(/^Element '.*' is unexpected according to content model of parent element '.*'.\s*Expecting:(?: {[\w:\/\-]*}(\w*)[,]?)+\w*\.\s*$/);
var values = reqReg.exec(exmpleString)//String listed as String to search
errorContainer.appendChild(document.createTextNode(values));
Element '{http://example.com/dev}emailCredit' is unexpected according to content model of parent element '{http://example.com/dev}promotion'.
Expecting: {http://example.com/dev}programmingCredit, {http://example.com/dev}cfppCredit.
,programmingCredit,cfppCredit
Element '{http://example.com/dev}emailCredit' is unexpected according to content model of parent element '{http://example.com/dev}promotion'.
Expecting: {http://example.com/dev}programmingCredit, {http://example.com/dev}cfppCredit.
,cfppCredit
example.com
maybe it should be:
[\w.:\/-]
note that in perl the order of the characters inside the square brackets is ignored and a dot does not need escaping.