Javascript examples for String Operation:String Search
Use RegEx to get end of string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w. ja v a 2s . co m var patternURL = new RegExp("http(s)?://www\.java2s\.com(/|/\\?ref=(tn_tnmn|logo)+)?$", "m"); var targetURL = "https://www.java2s.com/messages"; console.log (patternURL.test("https://www.java2s.com/?ref=tn_tnmn")); } </script> </head> <body> </body> </html>