Skip to content

Instantly share code, notes, and snippets.

@isXander
Created August 9, 2021 20:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save isXander/d60c1f457353509ceecf9b556cee4d66 to your computer and use it in GitHub Desktop.
Save isXander/d60c1f457353509ceecf9b556cee4d66 to your computer and use it in GitHub Desktop.
Cool Regexes
ip = /([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})/i
url = /https?:\/\/(www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:% +.~#?&//=]*)/i
minecraft_sensitive_info = /("access_key":".+"|api.sk1er.club\/auth|LoginPacket|SentryAPI.cpp|"authHash":|"hash":"|--accessToken \S+|\(Session ID is token:|Logging in with details: |Server-Hash: |Checking license key :|USERNAME=.*|https:\/\/api\.hypixel\.net\/.+(\?key=|&key=))/i
email = /[a-zA-Z0-9_.+-]{1,50}@[a-zA-Z0-9-]{1,50}\.[a-zA-Z0-9-.]{1,10}/i
pastebin = /(?:https?:\/\/)?(?<domain>paste\.ee|pastebin\.com|has?tebin\.com|hasteb\.in|hst\.sh)/(?:raw/|p\/)?([\w-.]+)/i
markdown_code_block = /```(?<language>[a-zA-Z0-9]*)\n(?<code>.+)\n```/s
windows_mac_username = /Users[\/\\](?<username>[^/\\]+)(?:[\/\\]*.)*/
linux_username = /\/home\/(?<username>[^\/]+)(?:\/*[^\/])*/
forge_mod_regex = /(?<state>(?:U?L?C?H?I?J?A?D?E?)+)\t(?<id>(?: ?[\w-]+)+)\{(?<version>(?:[0-9-\w]\.*)+)\} \[(?<name>(?: ?[\w-]+)+)\] \((?<file>(?: ?(?:[^/<>:\"\\|?* ])+)+)\)/
essential_mod_regex = /(?<state>(?:U?L?C?H?I?J?A?D?E?)+) +\| +(?<id>(?: ?[\w-]+)+) +\| +(?<version>(?:[0-9-\w]\.*)+) +\| +(?<file>(?: ?(?:[^/<>:\"\\|?* ])+)+)/
obfuscated_class = /[Il]{5,}/
hypixel_player_chat = /^(\\[[0-9]+\\?\\] |)(\\[(MVP|VIP|PIG|YOUTUBE|MOD|HELPER|ADMIN|OWNER|MOJANG|SLOTH|EVENTS|MCP)\\+*\\] |)([a-zA-Z0-9_]+): .*$/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment