lorey / social-media-profiles-regexs Goto Github PK
View Code? Open in Web Editor NEW:card_index: Extract social media profiles and more with regular expressions
:card_index: Extract social media profiles and more with regular expressions
https?://[w.]{4}?(youtube.com/user/[A-z_0-9-.]{2,100})
JS regex equivalent for all of these be very helpful.
Currently these types of facebook urls are not supported:
https://es-la.facebook.com/Andres.Agulla.ESPN/
https://fr-fr.facebook.com/Andres.Agulla.ESPN/
(?:https?:)?//(?:www.)?(?:facebook|fb).com/(?P(?![A-z]+.php)(?!marketplace|gaming|watch|me|messages|help|search|groups)[A-z0-9_-.]+)/?
my string looks like this
[
{
"node":{
"id":"100084753152635",
"url":"https:\/\/www.facebook.com\/profile.php?id=100084753152635",
"name":"Hannah"
}
},
{
"node":{
"id":"100049247496610",
"__isProfile":"User",
"url":"https:\/\/www.facebook.com\/sayar.tole.31",
"name":"\u1010\u102d\u102f\u1038 \u101d\u1031 \u101c\u1004\u103a\u1038"
}
}
]
Can you add Pinterest regex?
LinkedIn Recruiter urls do not have an in
or pub
on the path but recruiter
.
Example : http(s)?:\/\/([\w]+\.)?linkedin\.com\/(in|pub|recruiter)\/[A-z0-9_-]+\/?
I noticed that the regexes used do not provide username back as part of the regex. An example on how to do this is:
(?:(?:http|https)://)?(?:www.|m.)?facebook.com/(?!home.php)(?:(?:\w)#!/)?(?:pages/)?(?:[?\w-]/)?(?:profile.php?id=(?=\d.*))?([\w.-]+)$
This allows you to filter out all the things you do not need and only return username as a result.
Wouldn't it be a good idea to take this as the standard for this repo?
Example for instagram that only returns username:
https://regex101.com/r/DBVLCq/1
(Might also be a good idea to always include a regex101.com address so people can add tests and improve regexes
Most social networks use https or redirect entries on port 80 to 443 ... unknown that does not use https ๐จ
In cases (obvious) where the service uses https but the user informs http ... the link may even be correct because it points to a valid endpoint once the application server redirects it, however in my opinion (not based on a normalization) the regex should fail (deny)
The GitHub for example (the regex) in my view is incorrect because the site itself does not transmit data if not by https and the www subdomain is not used
// how are you now
http(s)?:\/\/(www\.)?github\.com/[A-z 0-9 _ -]+\/?
// perhaps a more correct approach
https:\/\/github\.com/[a-zA-Z0-9_-]+\/?
As I was testing some patterns, I noticed that you used 'A-z' for alphanumeric characters. When you do that, it will match any character between 65-122 ASCII, that includes lowercase, uppercase, and a few special characters, including underscores. To fix that and only include characters a-z(97-122) and A-Z(65-90), you need to change 'A-z' to 'a-zA-Z'
Please review this proposal, because current is false
/^http(s)?:\/\/(www\.)?linkedin\.com\/in\/([a-z0-9_-])*\/?$/i
Flag i
is active
Example
https://regexr.com/44amu
I've been developing a library for server-side & client-side link identification & validation. I've been using the non-capturing groups (?:s)?
and (?:www\.)?
. The regex parser will use it to match the text, but ignores it later when returning the results and can make it easier to identify the account/user/media ID.
Example: ^http(?:s)?:\/\/(?:www\.)?facebook\.com\/([a-zA-Z0-9_]+)$
I see that there hasn't been any additions within the last 2 years. Here are the ones that you've identified that match some of the initial regex filters I've written. (NOTE: These also work extremely well when using the jQuery validation and adding the regex below to the data-rule-pattern
attributes.)
Instagram
^http(?:s)?:\/\/(?:www\.)?instagram\.com\/([a-zA-Z0-9_]+)$
Google Plus
^http(?:s)?:\/\/plus\.google\.com\/(.+)$
Pinterest
^http(?:s)?:\/\/(?:www\.)?pinterest\.com\/([a-zA-Z0-9_]+)$
Vimeo Video
^http(?:s)?:\/\/(?:www\.)?vimeo\.com\/(?:channels\/[0-9]+\/)?([0-9]+)$ ^http(?:s)?:\/\/(?:www\.)?vine\.co\/v\/([a-zA-Z0-9_\/]+)$
VimeoChannel
^http(?:s)?:\/\/(?:www\.)?vimeo\.com\/channels\/([0-9]+)$
Skype
^skype:([a-zA-Z0-9_]+)\?call$
WordPress
^http(?:s)?:\/\/(?:[a-zA-Z0-9-]+)?.wordpress\.com\/(?!feed)(.+)?$
YouTube Channel
^http(?:s)?:\/\/(?:www\.)?youtube\.com\/channel\/(?:\w+\/)?([a-zA-Z0-9_-]+)$
YouTube Embed
^http(?:s)?:\/\/(?:www\.)?youtube.com\/embed\/([a-zA-Z0-9_-]+)$
YouTube User
^http(?:s)?:\/\/(?:www\.)?youtube\.com\/user\/(?:\w+\/)?([a-zA-Z0-9_-]+)$
YouTube Video
^http(?:s)?:\/\/(?:www\.)?youtube\.com\/(?!user)(?!channel)(?:\w+\/)?([a-zA-Z0-9_-]+)(?:\/)?$
YouTube Video
^http(?:s)?:\/\/youtu.be/([a-zA-Z0-9_-]+)$
StackOverflow
^http(?:s)?:\/\/(?:www\.)?stackoverflow\.com\/(.+)$
For example https://www.facebook.com
and //www.facebook.com
would work, whereas www.facebook.com
wouldn't work.
Is this an error?
It would be beneficial to have regex's not require the https://
for the off chance they're not specified in some document being scraped
There is a bug in the linkedin recruiter URL regex, it lacks the "profile" part
This is how the link should be
https://www.linkedin.com/recruiter/profile/476162262,HHNH,name
Also, the URL regex for the "talent" endpoint is missing
https://www.linkedin.com/talent/profile/AEEAABxhqNYBJa6QzJWImzsC_q6ugSZg2H6s7pA
Please let me know if you'd like a pull request or you'll fix them by yourself :)
Edit: /sales is also missing.
I'll create a regex and a PR later :)
You should show in the readme.md of your GitHub repo under which license your code can be used.
Regex should include protocol and host Name part as Option not mandatory
Example:
(http(s)?://[\w]+.)?linkedin.com/in/(A-z 0-9 _ -)/?
Let's add a test case for #23 to ensure people see examples of accented slugs in the wild ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.