python: Fix escaping of quote in patterns

This commit is contained in:
Ville Skyttä 2016-08-29 21:25:13 +03:00
parent dd1ed12318
commit a4dbd761f8

View File

@ -203,7 +203,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
+ "/pattern/modifiers convention. "+pattern+" is not valid.");
}
String regex = pattern.substring(1, i).replace("'", "\'");
String regex = pattern.substring(1, i).replace("'", "\\'");
List<String> modifiers = new ArrayList<String>();
for(char c : pattern.substring(i).toCharArray()) {