Skip navigation.
Home
Semantic Software Lab
Concordia University
Montréal, Canada

jape file with a Regular Expression containing a backslash does not parse in GATE

Printer-friendly versionPrinter-friendly versionPDF versionPDF version

Hello

I am using Gate 6.1 and have a jape file with a valid regular expression in it
which is not parsing - so I am unable to load it as a ProcessingResource

Here is the line on the jape file that the parser chokes on
{Token.kind == word, Token.string =~ "[A-Za-z]+.+\.ear"}

and here is the error I get in the Messages tab

Caused by: gate.jape.JapeException: Batch: error parsing transducer: Cannot parse a phase in file:/C:/NotBackedUp/GateTesting1/workingjapes/earfilename/earFile.jape: Lexical error at line 14, column 61. Encountered: "." (46), after : "\"[A-Za-z]+.+\\"
at gate.jape.Batch.parseJape(Batch.java:227)
at gate.jape.Batch.(Batch.java:91)
at gate.creole.Transducer.init(Transducer.java:106)
... 3 more

I have checked that "[A-Za-z]+.+\.ear" is a valid regular expression and should match this string ClientServices-06.00.0.5_3603_2.ear

Any help is much appreciated

Regards
Lesley

rene's picture

Try the gate-users mailing list

Hi Lesley,

For general GATE questions, best ask on the gate-users mailing list. This forum is specifically for question on the tools and resources published by us.

I think this question was actually already answered on the ML before, so try searching the archives -- if I remember correctly, you need to escape the \ in the regular expression in Java to \\\.

Best, René