"Correct regEx in expression builder not accepted"

kypexinkypexin Moderator, RapidMiner Certified Analyst, Member Posts: 291 Unicorn
edited June 2019 in Help

Hi rapidminers, 

 

Can someone suggest why this regex:

 

[a-zA-Z\u0080-\u024F\s\-\`\']+

 

is not accepted in expression builder? It is correct and validated via multiple online checkers.

 

Screenshot 2017-10-17 19.11.41.png

 

RapidMiner 7.6.001 under Windows. 

 

thanks.

Tagged:

Best Answer

  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,635 Unicorn
    Solution Accepted

    Yes, it's just different implementations of regex.  In the java version, the "\" is a special character so it needs to be declared with the special escape character for that, which also happens to be "\".  That's why you need "\\".  If you were wanting to use other regex special characters (like ?,+,., etc.) you would also need to preface them with "\" in RapidMiner.  So it's not the doubling of the character that matters, just the preface with "\".

     

     

    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts

Answers

  • kypexinkypexin Moderator, RapidMiner Certified Analyst, Member Posts: 291 Unicorn

    By chance I found that it works with double escape characters: 

     

    Screenshot 2017-10-17 19.26.14.png

     

    Though the question remains, why this particular editor expects \\ instead of \ ? 

     

    Thanks. 

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager

    Hi @kypexin - so I have found that the online RegEx expression testers are usually running JavaScript, which appears to sometimes parse expressions differently than Java (which is how RapidMiner does it).  Don't ask me why.  I think Ingo posted something about this a while ago...

     

    Scott

     

  • kypexinkypexin Moderator, RapidMiner Certified Analyst, Member Posts: 291 Unicorn

    Thank you guys for sharing some secret knowledge :) 

     

     

Sign In or Register to comment.