javascript - Regex any number mid-string -
i'm using javascript validate specific url can have multiple outcomes, i'm trying use regex this.
var regexnum = new regexp("[0-9]"); var x = checkpage(); // returns: "/appl/coursemenu/chapter/ (a number here) /" switch(x){ case "/appl/coursemenu/chapter/"+regexnum+"/": chapter(); break; }
so basic idea is specific url, has have number @ end. (and "/" )
thanks
[edit]
i added jsfiddle show going wrong in code: jsfiddle
var regexnum = new regexp("/appl/coursemenu/chapter/[0-9]/"); var x = checkpage(); // returns: "/appl/coursemenu/chapter/ (a number here) /" if(regexnum.test(x)){ chapter(); }
Comments
Post a Comment