question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid Regular Expression - 3.7.0

See original GitHub issue

Just upgraded to 3.7.0 and am getting the following error:

Uncaught SyntaxError: Invalid regular expression: /^\/about\/refund(?:\/(?=$))?$/: Stack overflow
    at RegExp.exec (<anonymous>)
    at Route.match (ostrio_flow-router-extra.js?hash=96883db4695d24ad4599b4bf3f9da15a27a28f8d:3808)
    at ostrio_flow-router-extra.js?hash=96883db4695d24ad4599b4bf3f9da15a27a28f8d:3789
    at nextEnter (ostrio_flow-router-extra.js?hash=96883db4695d24ad4599b4bf3f9da15a27a28f8d:3338)
    at ostrio_flow-router-extra.js?hash=96883db4695d24ad4599b4bf3f9da15a27a28f8d:3790
    at nextEnter (ostrio_flow-router-extra.js?hash=96883db4695d24ad4599b4bf3f9da15a27a28f8d:3338)
    at ostrio_flow-router-extra.js?hash=96883db4695d24ad4599b4bf3f9da15a27a28f8d:3790
    at nextEnter (ostrio_flow-router-extra.js?hash=96883db4695d24ad4599b4bf3f9da15a27a28f8d:3338)
    at ostrio_flow-router-extra.js?hash=96883db4695d24ad4599b4bf3f9da15a27a28f8d:3790
    at nextEnter (ostrio_flow-router-extra.js?hash=96883db4695d24ad4599b4bf3f9da15a27a28f8d:3338)

The error leads to this function, with m = this.regexp.exec(decodeURIComponent(pathname)); causing the issue.

 Route.prototype.match = function(path, params) {
    var keys = this.keys,
      qsIndex = path.indexOf('?'),
      pathname = ~qsIndex ? path.slice(0, qsIndex) : path,
      m = this.regexp.exec(decodeURIComponent(pathname));

    if (!m) return false;

    for (var i = 1, len = m.length; i < len; ++i) {
      var key = keys[i - 1];
      var val = this.page._decodeURLEncodedURIComponent(m[i]);
      if (val !== undefined || !(hasOwnProperty.call(params, key.name))) {
        params[key.name] = val;
      }
    }

    return true;
  };

My route for that one looks like this:

import { FlowRouter } from 'meteor/ostrio:flow-router-extra'
FlowRouter.route('/about/refund', {
    name: 'refund',
    async action(params, queryParams) {
        const { default: Layout } = await import('/client/layout')
        const {
            default: AboutRefund
        } = await import('/imports/client/terms/refund')
        mount(Layout, {
            content: <AboutRefund />,
        })
    }
})

Am I doing something dumb here?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jasongrishkoffcommented, Sep 21, 2019

Fixed!

0reactions
dr-dimitrucommented, Sep 21, 2019

@jasongrishkoff please try latest v3.7.1 release this issue should be fixed.

Feel free to close it in case if the issue is solved on your end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Syntax error: invalid regular expressions · Issue #13 - GitHub
When running the generator I get the following error in the console leading to not being able to run the generator.
Read more >
SyntaxError: invalid regular expression flag "x" - MDN Web Docs
The JavaScript exception "invalid regular expression flag" occurs when the flags in a regular expression contain any flag that is not one ...
Read more >
re — Regular expression operations — Python 3.11.1 ...
Source code: Lib/re/ This module provides regular expression matching operations similar to those found in Perl. Both patterns and strings to be searched ......
Read more >
Uncaught SyntaxError: Invalid regular expression
I am seeing this error in developer console on chrome. Uncaught SyntaxError: Invalid regular expression: /['窶兢/: Unterminated character ...
Read more >
SyntaxError: Invalid regular expression: - Stack Overflow
I'm pretty sure my regex is correct, but anytime I try to test the code, I get an invalid regular expression error with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found