[jboss-jira] [JBoss JIRA] Updated: (JBRULES-2745) Problems in the use of escapes in the "matches" operator
Alessandro Lazarotti (JIRA)
jira-events at lists.jboss.org
Thu Oct 21 14:09:55 EDT 2010
[ https://jira.jboss.org/browse/JBRULES-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alessandro Lazarotti updated JBRULES-2745:
------------------------------------------
Attachment: drools-simple-regex.zip
> Problems in the use of escapes in the "matches" operator
> --------------------------------------------------------
>
> Key: JBRULES-2745
> URL: https://jira.jboss.org/browse/JBRULES-2745
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 5.1.1.FINAL
> Reporter: Alessandro Lazarotti
> Assignee: Mark Proctor
> Attachments: drools-simple-regex.zip
>
>
> According to official documentation, it is not necessary to use escapes:
> "In contrast to Java, escapes are not needed within regular expressions written as string literals." (a note in topic 4.8.2.1.5.)
> But it is not true. Actually even the example of the documentation does not work if you do not use escape:
> //type is a String
> Cheese( type matches "(Buffalo)?\S*Mozarella" )
> ... should be changed to:
> //type is a String
> Cheese( type matches "(Buffalo)?\\S*Mozarella" )
> Curiously, if you have a attribute of the attribute which matches a regex, you shouldn't use escapes:
> //type is "complex type" and value is a String
> Cheese( type.value matches "(Buffalo)?\S*Mozarella" )
> ... it's work!
> That said, a workaround to work with simple String attributes, you should use "toString":
> //type is "String"
> Cheese( type.toString matches "(Buffalo)?\S*Mozarella")
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list