Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Check/Xtend: Regular Expression syntax
Check/Xtend: Regular Expression syntax [message #486335] Thu, 17 September 2009 06:23 Go to next message
Hauke Fuhrmann is currently offline Hauke Fuhrmann
Messages: 322
Registered: July 2009
Senior Member
Dear Xtend folks,

could you point me to some reference on the Syntax for regular
expressions for Strings in Xtend and Check?

I want to use e.g.

name.matches("MyRegex");

Where MyRegex is a regular expression. I tried to follow the Java Syntax
( http://java.sun.com/javase/6/docs/api/java/util/regex/Patter n.html ) like

name.matches("\w*");

to make sure that something only consists of word characters.
Unfortunately the syntax seems to be different.

Google didn't show me the way and the old oAW document also not
( http://www.openarchitectureware.org/pub/documentation/4.3.1/ html/contents/core_reference.html#r10_expressions_language
)

Cheers,
Hauke
Re: Check/Xtend: Regular Expression syntax [message #486630 is a reply to message #486335] Fri, 18 September 2009 09:16 Go to previous message
Sven Efftinge is currently offline Sven Efftinge
Messages: 1759
Registered: July 2009
Senior Member
Unfortunately, you have to double the backslashes.

So it is :
name.matches("\\w*");

Regards,
Sven

Hauke Fuhrmann schrieb:
> Dear Xtend folks,
>
> could you point me to some reference on the Syntax for regular
> expressions for Strings in Xtend and Check?
>
> I want to use e.g.
>
> name.matches("MyRegex");
>
> Where MyRegex is a regular expression. I tried to follow the Java Syntax
> ( http://java.sun.com/javase/6/docs/api/java/util/regex/Patter n.html ) like
>
> name.matches("\w*");
>
> to make sure that something only consists of word characters.
> Unfortunately the syntax seems to be different.
>
> Google didn't show me the way and the old oAW document also not
> ( http://www.openarchitectureware.org/pub/documentation/4.3.1/ html/contents/core_reference.html#r10_expressions_language
> )
>
> Cheers,
> Hauke


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Previous Topic:how exclude object from set
Next Topic:How include objects into new set
Goto Forum:
  


Current Time: Fri Aug 01 22:35:14 EDT 2014

Powered by FUDForum. Page generated in 0.01651 seconds