Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » regex/ocl
regex/ocl [message #32156] Sat, 07 July 2007 00:48 Go to previous message
Eclipse UserFriend
Originally posted by: asma.charfi.com

Hi,

I tried to use regex with ocl.
I follow "Customizing the Environment" topic in the "Advanced
Topics" in the OCL Programmer's Guide. to add new operation to String. (it
called ismatrix())
so I want to verify if my string respect or not the matrix form. (something
like that ((1,2),(3,4)) is accepted)
My constraint is like this
s.ismatrix('^\\((\\([0-9]+(,[0-9]+)*\\))(,\\([0-9]+(,[0-9]+) *\\))*\\)$')
<> null

I create a java class to verify my regex and it works perfectly.but when I
tested it with ocl it always returns false (the result of the regex is null)

I changed my pattern to simpler one s.ismatrix('\\d') <> null to verify if
my string contains a number. it also return false (independant of s)

I understand that problem in ocl when it evaluate my constraint and not in
the pattern

how can I change my pattern so that ocl gives me the right answer?

thank you
 
Read Message
Read Message
Read Message
Previous Topic:Parsing problem.
Next Topic:Referring to all attributes of a class/element.
Goto Forum:
  


Current Time: Fri May 10 00:02:18 GMT 2024

Powered by FUDForum. Page generated in 0.03521 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top