Last active
November 25, 2022 10:55
-
-
Save estevecastells/436c2a89277f757bcb38ae900fdac71e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Regex for getting everything after last trailing slash for URLs | |
(?!.*/).+ | |
### Get something inside parenthesis | |
/\(([^)]+)\)/ | |
### Match 9 numbers (or other quantity of numbers) | |
\b\d{9}\b | |
### Match two words in a sentence // Example regex strings being "vendita" and "appartamenti" | |
^.*?\bvendita\b.*?\bappartamenti\b.*?$ | |
### Match string between two different strings // Example regex strings being "displayValue": AND "searchRequestPageSize" | |
(?<="displayValue":)(.*)(?=,"searchRequestPageSize") | |
(?<="total":)(.*)(?=,"totalPages") | |
### Match everything after question mark // parameters | |
\?(.*) | |
### Match only numbers | |
^[0-9]*$ | |
### Scrape LinkedIn website in Company profile | |
(?<="data-tracking-control-name="about_website" target="_blank" rel="noopener" data-tracking-will-navigate>":)(.*)(?=,"<li-icon class="external-link__icon lazy-load about-us__icon"") | |
### Match all non english characters or numbers | |
^[a-zA-Z0-9$@$!%*?&#^-_. +]+$ | |
### Regex match everything after " : " | |
\ : (.*) | |
### Regex to match relative URLs inside a page and extract them | |
(?:url\(|<(?:link|script|img)[^>]+(?:src|href)\s*=\s*)(?!['"]?(?:data|http))['"]?([^'"\)\s>]+) | |
### Match string that has two slashes | |
^[^/]*/[^/]*/[^/]*$ | |
### Regex only matching numbers | |
^ *\d[\d ]*$ | |
### Regex to match empty lines in a file | |
^$\n | |
### Regex to match the first trailing slash in a list | |
^[^/]*/ | |
### Regex to delete everything after a comma (or any character if you change the comma for that character, remember to escape characters if reserved) | |
,.*$ | |
### Match everything after a comma | |
,[0-9]+ | |
### Match nothing | |
.{0} | |
### Regex to extract within an HTML element a given integrer number | |
<[^>]*(?:title)[^>]*>(\d+)\.?(\d+)?\.?(\d+)?[\s<] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment