Login, signup.. crawling — regex I only use once in a blue moon.
And regex looks so much like a secret code.. so I just.. always googled and copy-pasted it. It was off my radar.
But lately.. studying [Python, statistics] I've been using it a lot, which got awkward in many ways.
Over the weekend.. while eating alone and browsing YouTube for something to watch.. I stumbled onto a video by Ellie.
Regex — don't put it off any longer
The title hit a nerve... I clicked. youtu.be/t3M6toIflyQ
Oh~ thanks to it, regex completely conquered! Strongly recommended.
Review: from the addresses below, extract the keyword part ( ~ youtu.be/~~~~ ).
https://www.youtu.be/-normalstory
http://www.youtu.be/-thinknormal
https://youtu.be/normal_story
youtu.be/think_normal
Solution: very personal.
1) Write a sample URL with the most variety, split into groups, and append ? to words that may be optional.
(https?://)(www.)youtu.be/(-normalstory|normal_story)
2) Add backslashes to special characters.
(https?:\/\/)(www\.)youtu.be\/(-normalstory|normal_story)
3) Replace specific words with character ranges [ ] and quantifiers { }.
(https?:\/\/)(www\.)youtu.be\/([a-zA-Z0-9-]{12}|[a-zA-Z0-9]*_[a-zA-Z0-9]*)
4) Exclude unused groups from memory.
(?:https?:\/\/)?(?:www\.)?youtu.be\/([a-zA-Z0-9-]{12}|[a-zA-Z0-9]*_[a-zA-Z0-9]*)
Practice: test it in the browser console.
Learning references
GitHub github.com/dream-ellie/regex
dream-ellie/regex
Contribute to dream-ellie/regex development by creating an account on GitHub.
github.com
Practice site regexr.com/5mhou
RegExr: Learn, Build, & Test RegEx
RegExr is an online tool to learn, build, & test Regular Expressions (RegEx / RegExp).
regexr.com
Another recommended site regexone.com/
RegexOne - Learn Regular Expressions - Lesson 1: An Introduction, and the ABCs
Regular expressions are extremely useful in extracting information from text such as code, log files, spreadsheets, or even documents. And while there is a lot of theory behind formal languages, the following lessons and examples will explore the more prac
regexone.com




