Re: [rules-users] matches operator

2012-03-11 Thread Wolfgang Laun
As the Expert manual has it:
   a matches b
   a is any string, b is a string containing a regular expression

See java.util.regex.Pattern for more documentation.

The matches operator works via the method Matcher.matches, so looking for
xyz anywhere in a string will require a pattern like .*xyz.*.

-W


On 11 March 2012 12:18, shawn youngxiao...@hotmail.com wrote:

 Hey there.
 I get stuck on using matches operator. The Documentation doesn't say the
 operator in details.
 I just need to find whether String2 contains String1 (Ignore Case).
 Now I have a key(String variable) and a value(String variable).
 If I write key matches value, I know it definitely wrong. So is there
 anyone
 knows how to write it?

 Cheers.
 Shawn

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/matches-operator-tp3816492p3816492.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] matches operator

2012-03-11 Thread shawn
Thanks for your reply.
Is this means I can't match two string variables?
Only match a string constant with a string variable? 

--
View this message in context: 
http://drools.46999.n3.nabble.com/matches-operator-tp3816492p3816818.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] matches operator

2012-03-11 Thread Michael Anstis
IIRC you can match a variable with a constant. You might be able to achieve
what you require with a custom operator. Unfortunately I am not the one to
advise how to write or configure a custom operator :(

sent on the move

On 11 Mar 2012 15:39, shawn youngxiao...@hotmail.com wrote:

 Thanks for your reply.
 Is this means I can't match two string variables?
 Only match a string constant with a string variable?

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/matches-operator-tp3816492p3816818.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] matches operator

2012-03-11 Thread shawn
Thanks

--
View this message in context: 
http://drools.46999.n3.nabble.com/matches-operator-tp3816492p3816900.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] matches operator

2012-03-11 Thread Wolfgang Laun
The second operand of matches is just another String expression, and
therefore it could be a string literal, a variable bound to a String field,
or a String expression.

For instance, this
  $f1: Foo( $id1: id )
  $f2: Foo( this != $f1, $id2: id matches .* + $id1 + .* )
is a test for $id2 being a substring of $id1.

Or you could do
  $f1: Foo( $id1: id )
  $f2: Foo( this != $f1, $id2: id matches .*( + $id1 + )\\1.* )
which tests - what?

-W


On 11 March 2012 17:39, shawn youngxiao...@hotmail.com wrote:

 Thanks

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/matches-operator-tp3816492p3816900.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] matches operator

2007-07-09 Thread Mark Proctor

Read up on regular expression, what you just wrote there is not valid.

Mark
Ashwini Joshi wrote:


Hi,

 

 


Has anyone used the matches operator?

In our application we need to support startWith, endsWith operators 
for string variable. I am thinking of using matches operator. But the 
'matches' operator is not working. I am trying the following code


 


*rule* Hello World

  *when*

m : Message(message matches Hello*)

  *then*

System.out.println( Hello World);

*end*

 

 

 

And the value set in the message is Hello World. But it is not going 
into the then clause.


 

If anyone has already used matches operator I would like to know how 
we can use it for startswith, endsWith. How do we specify the regular 
expression? Can we use *


 

 


Thanks,

Ashwini

DISCLAIMER == This e-mail may contain privileged and 
confidential information which is the property of Persistent Systems 
Pvt. Ltd. It is intended only for the use of the individual or entity 
to which it is addressed. If you are not the intended recipient, you 
are not authorized to read, retain, copy, print, distribute or use 
this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent 
Systems Pvt. Ltd. does not accept any liability for virus infected mails.




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
  


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] matches operator

2007-07-09 Thread Hehl, Thomas
Also, Java is far stricter on syntax for regular expressions than anything
else I've seen. You can't just test your stuff at a unix prompt or using
grep to see if it works. That's just the first step. I generally use the vi
find command.

 

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Proctor
Sent: Monday, July 09, 2007 7:16 AM
To: Rules Users List
Subject: Re: [rules-users] matches operator

 

Read up on regular expression, what you just wrote there is not valid.

Mark
Ashwini Joshi wrote: 

Hi,

 

 

Has anyone used the matches operator? 

In our application we need to support startWith, endsWith operators for
string variable. I am thinking of using matches operator. But the 'matches'
operator is not working. I am trying the following code

 

rule Hello World

  when

m : Message(message matches Hello*)

  then

System.out.println( Hello World); 

end

 

 

 

And the value set in the message is Hello World. But it is not going into
the then clause.

 

If anyone has already used matches operator I would like to know how we can
use it for startswith, endsWith. How do we specify the regular expression?
Can we use *

 

 

Thanks,

Ashwini

DISCLAIMER == This e-mail may contain privileged and confidential
information which is the property of Persistent Systems Pvt. Ltd. It is
intended only for the use of the individual or entity to which it is
addressed. If you are not the intended recipient, you are not authorized to
read, retain, copy, print, distribute or use this message. If you have
received this communication in error, please notify the sender and delete
all copies of this message. Persistent Systems Pvt. Ltd. does not accept any
liability for virus infected mails.

 





  _  



 
___
rules-users mailing list
rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org 
https://lists.jboss.org/mailman/listinfo/rules-users
https://lists.jboss.org/mailman/listinfo/rules-users 
  

 

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] matches operator

2007-07-09 Thread Hehl, Thomas
Try ^Hello.* I think, I'm not very good with regular expressions.

 

For more information, have a look at:
http://www.regular-expressions.info/tutorial.html

 

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ashwini Joshi
Sent: Monday, July 09, 2007 8:54 AM
To: 'Rules Users List'
Subject: RE: [rules-users] matches operator

 

Can you please give me example of using matches operator for startswith?

 

 

Thanks,

Ashwini

 

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hehl, Thomas
Sent: Monday, July 09, 2007 5:31 PM
To: 'Rules Users List'
Subject: RE: [rules-users] matches operator

 

Also, Java is far stricter on syntax for regular expressions than anything
else I've seen. You can't just test your stuff at a unix prompt or using
grep to see if it works. That's just the first step. I generally use the vi
find command.

 

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Proctor
Sent: Monday, July 09, 2007 7:16 AM
To: Rules Users List
Subject: Re: [rules-users] matches operator

 

Read up on regular expression, what you just wrote there is not valid.

Mark
Ashwini Joshi wrote: 

Hi,

 

 

Has anyone used the matches operator? 

In our application we need to support startWith, endsWith operators for
string variable. I am thinking of using matches operator. But the 'matches'
operator is not working. I am trying the following code

 

rule Hello World

  when

m : Message(message matches Hello*)

  then

System.out.println( Hello World); 

end

 

 

 

And the value set in the message is Hello World. But it is not going into
the then clause.

 

If anyone has already used matches operator I would like to know how we can
use it for startswith, endsWith. How do we specify the regular expression?
Can we use *

 

 

Thanks,

Ashwini

DISCLAIMER == This e-mail may contain privileged and confidential
information which is the property of Persistent Systems Pvt. Ltd. It is
intended only for the use of the individual or entity to which it is
addressed. If you are not the intended recipient, you are not authorized to
read, retain, copy, print, distribute or use this message. If you have
received this communication in error, please notify the sender and delete
all copies of this message. Persistent Systems Pvt. Ltd. does not accept any
liability for virus infected mails.

 
 
 
 
 





  _  



 
 
 
 
 
___
rules-users mailing list
rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org 
https://lists.jboss.org/mailman/listinfo/rules-users
https://lists.jboss.org/mailman/listinfo/rules-users 
  

 

DISCLAIMER == This e-mail may contain privileged and confidential
information which is the property of Persistent Systems Pvt. Ltd. It is
intended only for the use of the individual or entity to which it is
addressed. If you are not the intended recipient, you are not authorized to
read, retain, copy, print, distribute or use this message. If you have
received this communication in error, please notify the sender and delete
all copies of this message. Persistent Systems Pvt. Ltd. does not accept any
liability for virus infected mails.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users