[rules-users] string replace collision problem

FrankVhh frank.vanhoenshoven at agserv.eu
Thu Nov 24 03:11:49 EST 2011


I am sorry, but that would not work either. The first rule would not catch
those sentences that have both S and SF in them.

You will have to work in three steps and use an intermediate value.

1. Change SF to Q
2. Change S to VOL
3. Change Q to S

Separate your steps by using ruleflow or agenda-groups. Make sure to update
your WM after every change.

Sorry for the confusion.

Regards,
Frank


FrankVhh wrote
> 
> Hi,
> 
> Sorry, but I fogot about you :-(.
> 
> It does not work because both wolfgang and I did get your question wrong.
> 
> If I were you, I would try to work from the opposite direction and check
> whether a String matches S but not SF. Than replace that S by VOL.
> 
> A second rule could than safely check for SF and replace that by S.
> 
> In short, reverse your salience, check that S is not SF and make sure that
> you replace the right S in the RHS of your rules. You do not want to
> update the WM.
> 
> Regards,
> Frank
> 
> 
> fiitkar wrote
>> 
>> Sorry, it does not work.
>> For input SF I allways get VOLVOLFVOL.
>> 
>> Once again: if the input is S the output should be VOL. But if the input
>> string contains SF the output should be S and not VOL.
>> 
>> For example: 
>> SF --> S
>> SSF --> VOLS
>> SFSF -> SS
>> etc.
>> 
> 


--
View this message in context: http://drools.46999.n3.nabble.com/string-replace-collision-problem-tp3518826p3533054.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list