Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- google.com
- www.google.com
- http//google.com
- http//www.google.com
- https://google.com
- https://www.google.com
- ftp://google.com
- var_dump(
- filter_var(
- 'http://stack-overflow.com/questions/19437105/using-regx-how-to-validate-url?noredirect=1#comment28819663_19437105',
- FILTER_VALIDATE_URL
- )
- );
- //output: string(113) "http://stack-overflow.com/questions/19437105/using-regx-how-to-validate-url?noredirect=1#comment28819663_19437105"
- var_dump(
- filter_var(
- 'http://stack_overflow.com/questions/19437105/using-regx-how-to-validate-url?noredirect=1#comment28819663_19437105',
- FILTER_VALIDATE_URL
- )
- );
- //output: bool(false)
- var_dump(parse_url('http://stackoverflow.com/questions/19437105/using-regx-how-to-validate-url?noredirect=1#comment28819663_19437105'));
- array(5) {
- ["scheme"]=>
- string(4) "http"
- ["host"]=>
- string(17) "stackoverflow.com"
- ["path"]=>
- string(50) "/questions/19437105/using-regx-how-to-validate-url"
- ["query"]=>
- string(12) "noredirect=1"
- ["fragment"]=>
- string(24) "comment28819663_19437105"
- }
- ^((ht|f)tp(s?)://|~/|/)?([w]+:w+@)?([a-zA-Z]{1}([w-]+.)+([w]{2,5}))(:[d]{1,5})?/?(w+.[w]{3,4})?((?w+=w+)?(&w+=w+)*)?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement