Skip to content
Permalink
Browse files

[JENKINS-10139] Added method to return a java script encoded variant …

…of the regex. Back slash is a special char and this will fix the problem with back slashes in regular expresions
  • Loading branch information
redsolo committed Sep 11, 2011
1 parent b787ed0 commit 80a358fbc2eaff755116d32f83ee64fb5912721b
@@ -73,6 +73,10 @@ public String getRegex() {
return regex;
}

public String getJsEncodedRegex() {
return regex.replace("\\", "\\\\");
}

public String getFailedValidationMessage() {
return failedValidationMessage;
}
@@ -29,7 +29,7 @@ THE SOFTWARE.
<div name="parameter" description="${it.description}">
<input type="hidden" name="name" value="${it.name}" />
<f:textbox name="value" value="${it.defaultValue}"
checkUrl="'${it.rootUrl}/descriptor/hudson.plugins.validating_string_parameter.ValidatingStringParameterDefinition/validate?regex='+encodeURIComponent(&quot;${it.regex}&quot;)+'&amp;failedValidationMessage='+encodeURIComponent(&quot;${it.failedValidationMessage}&quot;)+'&amp;value='+encodeURIComponent(this.value)"/>
checkUrl="'${it.rootUrl}/descriptor/hudson.plugins.validating_string_parameter.ValidatingStringParameterDefinition/validate?regex='+encodeURIComponent(&quot;${it.jsEncodedRegex}&quot;)+'&amp;failedValidationMessage='+encodeURIComponent(&quot;${it.failedValidationMessage}&quot;)+'&amp;value='+encodeURIComponent(this.value)"/>
</div>
</f:entry>
</j:jelly>

0 comments on commit 80a358f

Please sign in to comment.
You can’t perform that action at this time.