Jump to content
Sign in to follow this  
WesleyA

php regex for 'fake' protocols

Recommended Posts

How should I validate 'wrong' or 'fake' protocols? Not sure how to explain this.

 

 

I mean type mismatches like gttps : // but also random chars like qwerty : // should be validated. So chars before : //

 

( placed spaces in the protocols above else I wasnt possible to post it here)

 

How to do this with regex php?

Share this post


Link to post
Share on other sites

I don't think you need a regular expression for that. You can use things like substr and strpos to get the text before the colon, and compare that with a list of known protocols.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...