Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

another regex issue #47

Closed
xanoinc opened this issue May 16, 2015 · 2 comments
Closed

another regex issue #47

xanoinc opened this issue May 16, 2015 · 2 comments

Comments

@xanoinc
Copy link

xanoinc commented May 16, 2015

Getting an error with this code and a regex.

function() {
return /test?/g;
};

@xanoinc
Copy link
Author

xanoinc commented May 16, 2015

I narrowed the code above down from trying to compile bootstrap-datetimepicker.js

I was able to do a workaround by assigning the regex to a variable and then returning it. Something with the return statement is causing problems.

validParts:       function (type) {
  if (type == "standard") {
    var test = /hh?|HH?|p|P|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g;
    return test;
  } else if (type == "php") {
    var test = /[dDjlNwzFmMnStyYaABgGhHis]/g;
    return test;
  } else {
    throw new Error("Invalid format type.");
  }
},

@4DallasC
Copy link

4DallasC commented Sep 19, 2017

And another /\?/.test(a)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants