1//If URL contains "mystring"
2if (window.location.href.indexOf("mystring") > -1) {
3
4}
1<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
2<script type="text/javascript">
3 $(document).ready(function() {
4 if (window.location.href.indexOf("franky") > -1) {
5 alert("your url contains the name franky");
6 }
7 });
8</script>
1var reg = new RegExp('([a-zA-Z\d]+://)?((\w+:\w+@)?([a-zA-Z\d.-]+\.[A-Za-z]{2,4})(:\d+)?(/.*)?)', 'i')
2if (reg.test(status_text)) {
3 alert(reg.exec(status_text)[2]);
4}