OCLinEcore and Regex to create valid IPv4 string -


i have ecore model, i'm trying add ocl constraints.

my problem comes when try make property (a string) in valid ipv4 form. guess should use regular expression, have no idea @ how use regex on oclinecore.

as of eclipse juno, can use regular expressions in ocl. function call on matches(regex), in java.

context packet inv validipv4 : ip.matches('\b([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\b') 

source: http://help.eclipse.org/juno/index.jsp?topic=%2forg.eclipse.ocl.doc%2fhelp%2fcompleteocltutorial.html

if have previous version of eclipse, suggest adding java constraint on ecore element, validate element through generated java template code.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -