Skip to content
Permalink
Browse files
Java Regex and Oro differ when considering line ending
and use DOT_ALL to match new lines
  • Loading branch information
FSchumacher committed Mar 5, 2022
1 parent 75f9b91 commit a1780049b4dc3e8193b41459c74783b2ee004de2
Showing 3 changed files with 4 additions and 4 deletions.
@@ -337,7 +337,7 @@ private static int getPositionOfBody(String stringToCheck) {

private static int getPositionOfBodyWithJavaRegex(String stringToCheck) {
// The headers and body are divided by a blank line (the \r is to allow for the CR before LF)
String regularExpression = "^\\r$"; // $NON-NLS-1$
String regularExpression = "^$"; // $NON-NLS-1$
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(regularExpression,
java.util.regex.Pattern.CASE_INSENSITIVE | java.util.regex.Pattern.MULTILINE);

@@ -148,7 +148,7 @@ private Iterator<URL> getEmbeddedResourceURLsWithJavaRegex(byte[] html, URL base
String input = new String(html, encoding);
java.util.regex.Pattern pattern = JMeterUtils.compilePattern(
REGEXP,
java.util.regex.Pattern.CASE_INSENSITIVE
java.util.regex.Pattern.CASE_INSENSITIVE | java.util.regex.Pattern.DOTALL
);

Matcher matcher = pattern.matcher(input);
@@ -1190,7 +1190,7 @@ private String getSentRequestHeaderValue(String requestHeaders, String headerNam
private String getSentRequestHeaderValueWithJavaRegex(String requestHeaders, String headerName) {
String expression = ".*" + headerName + ": (\\d*).*";
java.util.regex.Pattern pattern = JMeterUtils.compilePattern(expression,
java.util.regex.Pattern.CASE_INSENSITIVE);
java.util.regex.Pattern.CASE_INSENSITIVE | java.util.regex.Pattern.DOTALL);
Matcher matcher = pattern.matcher(requestHeaders);
if (matcher.matches()) {
// The value is in the first group, group 0 is the whole match
@@ -1244,7 +1244,7 @@ private int getPositionOfBody(String stringToCheck) {

private int getPositionOfBodyWithJavaRegex(String stringToCheck) {
// The headers and body are divided by a blank line
String regularExpression = "^.$";
String regularExpression = "^$";
java.util.regex.Pattern pattern = JMeterUtils.compilePattern(regularExpression,
java.util.regex.Pattern.CASE_INSENSITIVE | java.util.regex.Pattern.MULTILINE);

0 comments on commit a178004

Please sign in to comment.