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

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -