ShellSpells
  • 🧙‍♂️Welcome!
    • ShellSpells
    • FAQs
    • License & Disclaimer
  • 🐧Linux
    • System Ops
      • Transcripts
      • Help
      • System Info
        • Date/Time
        • System Details
        • Patches & Updates
        • Init System Identification
        • Hostname / Host ID
        • Variables
        • Hardware & Resources
      • Filesystem
        • Traverse & Enumerate
        • Drives & Partitions
        • Shares
        • Packages
        • Connected Devices
        • Kernel Modules (Drivers)
      • Users & Groups
        • Enumerate
        • Modify
      • Network
        • Enumerate
        • Modify
      • Scheduled Jobs
        • Enumerate
        • Modify
      • Processes
        • Enumerate
        • Modify
        • Custom Script and Shared Object
        • Process I/O Redirection
      • Services
        • Enumerate
        • Modify
        • Create a Service
      • Startup/Boot Scripts
        • Enumerate
        • Modify
      • Security
        • Antivirus
        • Firewall
        • SSH Keys
      • History & Logs
        • History
        • Logs
    • File Ops
      • Search
        • Filename
        • Content
        • Users (Owners)
        • Time
        • Size
        • Permission
        • Hidden Files
        • Inode
        • Find + Exec
        • Notes
      • Enumerate Metadata
      • Modify Metadata
      • Read Content
      • Modify Content
      • Extract Content
      • Sort / Compare / Count
      • Move
      • Copy
      • Execute
      • Hash
      • Encode/Decode
      • Compress/Decompress
      • Working With Weird Filenames
    • Terminal Ops
      • Keyboard Shortcuts
      • Tmux Shortcuts
  • 🪟Windows
    • System Ops
      • Transcripts
      • Help
      • System Info
        • One-liners
        • Date/Time
        • System Details
        • Hotfixes
        • Domain or Workgroup
        • Data Execution Prevention
        • Variables
        • Hardware & Resources
      • Filesystem
        • Traverse & Enumerate
        • Drives & Partitions
        • Installed Software
        • Drivers
        • Shares
      • Registry
        • Enumerate
        • Modify
        • Forensically Relevant Keys
      • Users & Groups
        • Enumerate
        • Modify
      • Network
        • Enumerate
        • Modify
      • Scheduled Tasks
      • Processes
        • Enumerate
        • Modify
      • Services
        • Enumerate
        • Modify
      • Autorun / Startup
        • Enumerate
        • Modify
      • Security
        • Permissions
          • Enumerate
          • Page
        • Antivirus
        • Firewall
          • Enumerate
          • Modify
        • Audit Policies
        • Remoting
          • Enumerate
          • Modify
          • Registry Locations
        • Stored Credentials
      • Remote Command Execution
      • Active Directory
        • Enumerate
        • Modify
      • History & Logs
        • History
        • Logs
      • PowerShell Config
      • Scripting
      • WMIC Notes
    • File Ops
      • Search
        • Filename
        • Time
        • Size
        • Permissions
        • Attributes
        • Wildcarding
      • Enumerate Metadata
        • One Liners
        • Users (Owners)
        • Timestamps
        • Size
        • Permissions
        • Attributes
      • Modify Metadata
        • Change Owner
        • Timestamps
        • Size
        • Attributes
      • Read Content
      • Modify Content
        • Overwrite
        • Insert
        • Append
        • Replace / Remove
        • Convert Case
        • Alternate Data Streams
      • Extract Content
      • Sort / Compare / Count
        • Sort
        • Count
        • Compare
      • Move
      • Copy
      • Execute
      • Hash
      • Encode/Decode
      • Compress/Decompress
      • Working With Weird Filenames
      • Output Formatting / Filtering
      • File Formatting
      • Operators
  • ⛓️Network
    • Traffic Manipulation
      • iptables
        • Option List
        • General Commands
        • Filter Tables
        • NAT
        • Mangle
        • Filter for SSH Traffic (Example)
      • nftables
    • Packet Capture
      • Syntax
      • TCPDump Examples
    • Packet Analysis
      • Wireshark
  • 🚗Maneuver
    • SSH
    • Control Sockets
    • RDP
    • Windows Port Proxy
  • 🛩️Data Transfer
    • SCP
    • FTP
    • Netcat
      • Netcat Relays
    • Server Interactions
    • Alternate Methods
  • 🪄REGEX
    • Examples
Powered by GitBook
On this page
  • Emails
  • URLs
  • Numbers (with and without decimals)
  • Dates of all known formats
  • Time in all known formats
  • Phone Numbers
  • Zip Codes
  • Password Strength validation
  • File Extensions
  • IPv4 Addresses
  • Credit Card Numbers
  • City, State Abbreviations
  • Social Security Numbers
  • Dollar Amounts
  • Hexadecimal Values
  • MAC Addresses
  • HTML Tags

Was this helpful?

  1. REGEX

Examples

Emails

Matches valid email addresses.

^(?:[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$

Another pattern to match valid email addresses.

^\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b$

Yet another pattern to match valid email addresses.

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

URLs

Matches URLs with optional protocol and subdomains.

^(?:https?://)?(?:www\.)?[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(?:/\S*)?$

Another pattern to match URLs.

^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$ 

Yet another pattern to match URLs.

^(https?|ftp):\/\/[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+\/[^\s]*$

Numbers (with and without decimals)

Matches numbers with optional sign and decimal points.

^-?\d+\.?\d*$

Another pattern to match numbers.

^-?\d+(\.\d+)?$

Yet another pattern to match numbers.

^-?[0-9]+(\.[0-9]+)?$

Dates of all known formats

Matches dates in various formats.

^(?:(?:0?[1-9]|1[0-2])[-\/.](?:0?[1-9]|[12]\d|3[01])[-\/.]\d{4})|(?:(?:0?[1-9]|[12]\d|3[01])[-\/.](?:0?[1-9]|1[0-2])[-\/.]\d{4})|(?:(?:0?[1-9]|1[0-2])[-\/.]\d{1,2}[-\/.]\d{2,4})$

Another pattern to match dates.

^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$

Yet another pattern to match dates.

^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$

Time in all known formats

Matches time in various formats.

^(?:0?[1-9]|1[0-2]):(?:[0-5]\d)(?::(?:[0-5]\d))?(?:\s?[APap][mM])?$

Another pattern to match time.

^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$

Yet another pattern to match time.

^(0[0-9]|1[0-9]|2[0-3]):([0-5][0-9])(:[0-5][0-9])?$

Phone Numbers

Matches US phone numbers with optional area code and formatting.

^(?:\+?1[-. ]?)?\(?[2-9][0-9]{2}\)?[-. ]?[2-9][0-9]{2}[-. ]?\d{4}$

Another pattern to match phone numbers.

^(\+\d{1,2}\s?)?((\(\d{3}\))|\d{3})([\s.-]?)\d{3}([\s.-]?)\d{4}$

Yet another pattern to match phone numbers.

^([+]?[0-9]{1,2}[.-\s]?)?(\([0-9]{3}\)|[0-9]{3})[.-\s]?[0-9]{3}[.-\s]?[0-9]{4}$

Zip Codes

Matches US zip codes in various formats.

^\d{5}(?:-\d{4})?$

Another pattern to match US zip codes.

^\d{5}-\d{4}(?:\d{2})?$

Yet another pattern to match US zip codes.

^\d{5}(?:-\d{4})?$

Password Strength validation

Matches passwords with at least 8 characters, containing at least one uppercase letter, one lowercase letter, one number, and one special character.

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$

Another pattern for password validation.

^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$

Yet another pattern for password validation.

^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$

File Extensions

Matches file extensions (e.g., .txt, .jpg, .pdf).

\.\w+$

Another pattern to match file extensions.

\.(?:jpg|gif|png|pdf|)$

IPv4 Addresses

Matches IPv4 addresses in dotted decimal notation.

^(?:\d{1,3}\.){3}\d{1,3}$

Another pattern to match IPv4 addresses.

^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$

Credit Card Numbers

Matches credit card numbers in various formats.

^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$

Another pattern to match credit card numbers.

^(?:\d[ -]*?){13,16}$

City, State Abbreviations

Matches US city names followed by state abbreviations.

^[a-zA-Z\s]+,\s*[A-Z]{2}$

Another pattern to match city names and state abbreviations.

^[a-zA-Z\s]+,\s*[A-Z]{2}$

Social Security Numbers

Matches US social security numbers in various formats.

^(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}$

Another pattern to match social security numbers.

^\d{3}-\d{2}-\d{4}$

Dollar Amounts

Matches dollar amounts in various formats.

^\$?\d{1,3}(?:,?\d{3})*(?:\.\d{2})?$

Another pattern to match dollar amounts.

^\$[0-9]+(\.[0-9]{2})?$

Hexadecimal Values

Matches hexadecimal values.

^(?:0[xX])?[0-9a-fA-F]+$

Another pattern to match hexadecimal values.

^#?([a-f0-9]{6}|[a-f0-9]{3})$

MAC Addresses

Matches MAC addresses in various formats.

^(?:[0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$

Another pattern to match MAC addresses.

^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$

HTML Tags

Matches HTML tags.

<[^>]*>

Another pattern to match HTML tags.

<[a-zA-Z][^>]*>
PreviousAlternate Methods

Last updated 1 year ago

Was this helpful?

🪄