js uses regular rules to determine whether a link is valid

  if ($('input[name="iIsRedirect"]').prop('checked') && p2['sRedirectURL'] != '') {
            var sRedirectURL = $('input[name="sRedirectURL"]' ).val(),
                reg = /(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-)+)/g; / /Regular expression judges http://     https:// for legal

                objExp = new RegExp(reg);


            if (objExp.test(sRedirectURL) != true) {
                layer.alert('The jump address is incorrect!');
                return;
            }


        }

 reg = /^(http:\/\/|^https:\/\/|^\/\/)((\w|=|\?|\.|\/|&|-)+)/g ;  // Regular expression judges that http://     https:// //The beginning is legal

This method judges whether a url obtained is a valid address with a regular match

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325585203&siteId=291194637