url正则校验

    checkDisUrlTip = () => {
        const { brandWebsite }  = this.props;
        if(brandWebsite !== "") {
            let reg=/^((https|http|ftp|rtsp|mms)?:\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/;
            if(!reg.test(brandWebsite)){
                this.setState({
                    disURLtip:true
                })
            } else {
                this.setState({
                    disURLtip:false
                })
            }
        }
    }

你可能感兴趣的:(reg校验url)