<br> Hi, yes, close to that:<br><br>name returns [String name]<br> : ID { $name = $ID.text; }<br> | STRING { $name = getString( $STRING.text ); }<br> ;<br><br> So, a rule name can be either an ID or a STRING. ID is what you got already:
<br><br>ID <br> : ('a'..'z'|'A'..'Z'|'_'|'$'|'\u00c0'..'\u00ff')('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\u00c0'..'\u00ff')*
<br> ;<br><br> A String is a valid Java string... so pretty much anything enclosed in either " or '.<br><br>STRING<br> : ('"' ( EscapeSequence | ~('\\'|'"') )* '"')
<br> | ('\'' ( EscapeSequence | ~('\\'|'\'') )* '\'')<br> ;<br><br> In other words, if you want to allow the user to write rule names and don't want to bother in validating it, just enclose the rule name in " and be done with it. The only thing that may be good is to limit the length of the string... you may want to use a hard limit around 60 characters I guess.
<br><br> []s<br> Edson<br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/8/2, hypnosat7 <<a href="mailto:ablarbi@yahoo.fr">ablarbi@yahoo.fr</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>No I mean how can I check the validity of the rule names before put it in a<br>DB, maybe I have to look to DRL.g grammar file ?<br>is it this :<br><br>ID<br> :<br>('a'..'z'|'A'..'Z'|'_'|'$'|'\u00c0'..'\u00ff')('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'\u00c0'..'\u00ff')*
<br><br>thanks<br><br><br><br>Mark Proctor wrote:<br>><br>> There is no regexp for this. Easiest thing to do is make a package with<br>> a single rule in it and pass it into a packagebuilder session.<br>><br>> Mark
<br>> hypnosat7 wrote:<br>>> Hi,<br>>> When can I find the regular expression to check the validity of a rule<br>>> name ?<br>>> thanks<br>>><br>><br>> _______________________________________________
<br>> rules-users mailing list<br>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br>><br>><br><br>--<br>View this message in context: <a href="http://www.nabble.com/rule-name-regular-expression-tf4201280.html#a11959690">http://www.nabble.com/rule-name-regular-expression-tf4201280.html#a11959690
</a><br>Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli
<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>