0

I am creating rules through the drools-guvnor. I have imported my POJO model and everything is set up correctly (I have done tests) but I cant seems to figure out how to get the "matches" operator working correctly. This is what I have so far(source code):

rule "invilidSms"
dialect "mvel"
    when
        invalidSms : Policy( SMS_Area_Code matches "[0-9]{4,}" || matches "^[0-9]{0,2}" || matches "[0-9\\D]+" , SMS_TelNumber matches "[0-9]{4,}" || matches "^[0-9]{0,2}" || matches "[0-9\\D]+" , SMS_nixieindicator == "Y" || == "y" )
    then
        invalidSms.setSms( ""Invalid area code"" );
end

Could anyone give me any tips on using multiple regex checks in drools-guvnor or some way of getting this to work. It seems as though their forum is really stale. Most of the answers I could find on there haven't been answered.

Any help would be appreciated.

DeanMWake
  • 893
  • 3
  • 19
  • 38

1 Answers1

0

you could try to pipe the regular expressions only. something like:

rule "invilidSms"
dialect "mvel"
when
    invalidSms : Policy( SMS_Area_Code matches "[0-9]{4,}|^[0-9]{0,2}|[0-9\\D]+" , SMS_TelNumber matches "[0-9]{4,}|^[0-9]{0,2}|[0-9\\D]+" , SMS_nixieindicator matches "[Yy]"
then
    invalidSms.setSms( ""Invalid area code"" );
end
metar
  • 434
  • 7
  • 17
  • How would I do this through the gui though? It seems as if the gui creates them incorrectly. I am not creating technical rules, thats the problem – DeanMWake Aug 08 '13 at 06:37
  • what version you are using? I am on 5.3.1.Final and its working inside my business rule. You should have 3 condition columns and 1 action column. what also works is exporting the *.gdst file from guvnor, edit in texteditor and save it back. see this: [Accessing Guvnor as a Filesystem (WebDAV) ](http://blog.athico.com/2008/05/accessing-guvnor-as-filesystem-webdav.html) – metar Aug 08 '13 at 12:20
  • @MethodMan, could you please tell us how you solved the problem? – metar Oct 25 '13 at 12:16
  • Hi metar, I would suggest you either upgrade your version of drools or create a `regex` statement that can deal with all of the rules at once. That is how we managed to solve it. – DeanMWake Oct 29 '13 at 07:15