Tuesday, 10 July 2018

Sails.js - sails route with regular expression

I am working with sails 0.11.2. Here i am facing an issue with defining a route pattern that will start with '/source/< anything goes here>/< must not contain .js extension at the end>'

Regular Expression : /^\/source.*(?<!.js)$/i in java script in working fine, but when i am putting this in sails route.

Getting Error : Invalid regular expression: /^r|\/^\/source\.(.*)(?<!\.js)$\/i\/?$/: Invalid group .

Syntax in Route :

    'r|/^\/source.*(?<!.js)$/i' : {
    controller: 'pageController',
    action: 'pageAction'
  }    

Please help me out, what is wrong and how to correct it?



from Sails.js - sails route with regular expression

2 comments: