i’m having problem when i want to use regexp, i don’t know to using ‘or’ , ‘and’. like in if statement.
i’m having url like this
http://localhost:85/study/list
and i’m having the words(pattern to regexp) /,/list/top
when i try using this
url ="http://localhost:85/study/list";
regexp = RegExp(.*/?/list?/top);
var matches = url.match(regexp);
alert(matches);
and when i change url to http://localhost:85/top the word of /top not detection but /list is detection . what is wrong?
i wanna to match my words in that url , how i must create regexp for that?
please tell me your answer and please give me reference for the regexp
i’m newbie thanks for helping…
Man, you can test your expressions here RegexPal. It seems that the expression you using havo no effects.
This expression will match the last sub-directory of your url
For example
http://localhost:85/study/listwill matchlist,http://localhost:85/topwill match justtop.Try it! =)