Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » [EMFTVM] Problem with Back Slash character
[EMFTVM] Problem with Back Slash character [message #1321295] Tue, 29 April 2014 03:43 Go to next message
Victor Pavon is currently offline Victor Pavon
Messages: 49
Registered: April 2012
Location: Spain
Member
Hello,

I have a file path string where I'd like change all occurrences of Slash character by Back Slash character. I use the method replaceAll, but the problem is that I get the error:

org.eclipse.m2m.atl.emftvm.util.VMException: java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
 ^
at public java.lang.String java.lang.String.replaceAll(java.lang.String,java.lang.String)
	Local variables: []



Best regards,
Víctor Pavón.


Víctor Pavón,
Research at Quercus Software Engineering Group
University of Extremadura, Spain.
Re: [EMFTVM] Problem with Back Slash character [message #1321367 is a reply to message #1321295] Tue, 29 April 2014 04:39 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis Wagelaar
Messages: 155
Registered: September 2012
Senior Member

You need to escape the backslash by adding another backslash (i.e. '\\'). Can you show the ATL code?

Cheers,
Dennis
Re: [EMFTVM] Problem with Back Slash character [message #1321426 is a reply to message #1321367] Tue, 29 April 2014 05:24 Go to previous messageGo to next message
Victor Pavon is currently offline Victor Pavon
Messages: 49
Registered: April 2012
Location: Spain
Member
I escaped it. This is the ATL code:

helper context mmStrutsConfig!ForwardType def : getPages : Sequence(mmMIGRARIAMVC!Page) =
    thisModule.allPageInstances->select(page |    let pagePath : String = page.path.replaceAll('\\', '/') in página
                                                             				 pagePath.endsWith(self.path));


Víctor Pavón,
Research at Quercus Software Engineering Group
University of Extremadura, Spain.

[Updated on: Tue, 29 April 2014 05:25]

Report message to a moderator

Re: [EMFTVM] Problem with Back Slash character [message #1321885 is a reply to message #1321426] Tue, 29 April 2014 11:07 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis Wagelaar
Messages: 155
Registered: September 2012
Senior Member

try page.path.replaceAll('\\\\', '/')

Cheers,
Dennis
Re: [EMFTVM] Problem with Back Slash character [message #1323402 is a reply to message #1321885] Wed, 30 April 2014 04:32 Go to previous message
Victor Pavon is currently offline Victor Pavon
Messages: 49
Registered: April 2012
Location: Spain
Member
Thank you. Know works properly

Víctor Pavón,
Research at Quercus Software Engineering Group
University of Extremadura, Spain.
Previous Topic:sequence as return of a helper
Next Topic:[ATL] Translate BPMN models into UML
Goto Forum:
  


Current Time: Sat Aug 30 08:25:58 EDT 2014

Powered by FUDForum. Page generated in 0.01678 seconds