kung foo man
21st June 2016, 10:47
Hey all,
you can now add your YouTube / GitHub / Steam profile links to your user account. I had to add some regexes to prevent the input against XSS attacks, so this is what I came up with:
^(http|https)://(www.)?(youtube.com|youtu.be)/((c|channel|user)/)?(\+?)[a-zA-Z0-9_\-]+(/)?
http://youtube.com/YourGooglePlusName
http://youtube.com/+YourGooglePlusName
http://youtu.be/+YourGooglePlusName
https://youtube.com/c/KilltubeOrg
http://youtube.com/c/KilltubeOrg/
https://www.youtube.com/c/KilltubeOrg
https://www.youtube.com/channel/UCVuQk8dOOnP3NATrK_N4yHQ
^(http|https)://(www.)?steamcommunity.com/(id|profiles)/[a-zA-Z0-9_\-]+(/)?
https://steamcommunity.com/id/kungfoo_man123/
http://steamcommunity.com/id/kungfoo_man123/
https://www.steamcommunity.com/id/kungfoo_man123
http://www.steamcommunity.com/id/kungfoo_man123/
http://steamcommunity.com/profiles/NUMBERS_GO_HERE
^(http|https)://(www.)?github.com/[a-zA-Z0-9_\-]+(/)?
https://github.com/kungfooman/
http://www.github.com/kungfooman-asd
Great site for testing: http://www.phpliveregex.com/
If any valid link might not work, please tell me.
Are the any other sites which you wanna add to your profile?
Random ideas welcome aswell.
Edit #1: Added youtu.be, G+, and Steam /profiles/
you can now add your YouTube / GitHub / Steam profile links to your user account. I had to add some regexes to prevent the input against XSS attacks, so this is what I came up with:
^(http|https)://(www.)?(youtube.com|youtu.be)/((c|channel|user)/)?(\+?)[a-zA-Z0-9_\-]+(/)?
http://youtube.com/YourGooglePlusName
http://youtube.com/+YourGooglePlusName
http://youtu.be/+YourGooglePlusName
https://youtube.com/c/KilltubeOrg
http://youtube.com/c/KilltubeOrg/
https://www.youtube.com/c/KilltubeOrg
https://www.youtube.com/channel/UCVuQk8dOOnP3NATrK_N4yHQ
^(http|https)://(www.)?steamcommunity.com/(id|profiles)/[a-zA-Z0-9_\-]+(/)?
https://steamcommunity.com/id/kungfoo_man123/
http://steamcommunity.com/id/kungfoo_man123/
https://www.steamcommunity.com/id/kungfoo_man123
http://www.steamcommunity.com/id/kungfoo_man123/
http://steamcommunity.com/profiles/NUMBERS_GO_HERE
^(http|https)://(www.)?github.com/[a-zA-Z0-9_\-]+(/)?
https://github.com/kungfooman/
http://www.github.com/kungfooman-asd
Great site for testing: http://www.phpliveregex.com/
If any valid link might not work, please tell me.
Are the any other sites which you wanna add to your profile?
Random ideas welcome aswell.
Edit #1: Added youtu.be, G+, and Steam /profiles/