Elysia Tools

Browse tools, examples, visual explainers, and topic guides from one clear workspace.

Top Categories

Hubs

Language
ZHESPTRUFRDEEN

Elysia Tools

Navigation

Text Processing

Regex Named Capture Groups

Collection of regex patterns using named capture groups for extracting structured data from text. Named groups make patterns more readable and maintainable by assigning meaningful names to captured portions.

Samples

Entries inside this sample collection

TextregexSimple

Date Parsing Patterns

Extract date components (year, month, day) from various date formats using named capture groups

Difficulty

3/10

Estimated time

5 min

Tags

date, parsing, datetime, formatting

regex
# Date Parsing with Named Groups
# Extract year, month, and day from date strings

# ISO 8601 Format (YYYY-MM-DD)
# Pattern: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})
# Input: 2025-01-16
# Groups: year=2025, month=01, day=16
(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})

# US Format (MM/DD/YYYY)
# Pattern: (?<month>\d{2})/(?<day>\d{2})/(?<year>\d{4})
# Input: 01/16/2025
# Groups: month=01, day=16, year=2025
(?<month>\d{2})/(?<day>\d{2})/(?<year>\d{4})

# European Format (DD.MM.YYYY)
# Pattern: (?<day>\d{2})\.(?<month>\d{2})\.(?<year>\d{4})
# Input: 16.01.2025
# Groups: day=16, month=01, year=2025
(?<day>\d{2})\.(?<month>\d{2})\.(?<year>\d{4})

# Textual Month (YYYY-Mon-DD)
# Pattern: (?<year>\d{4})-(?<month>[A-Za-z]{3})-(?<day>\d{2})
# Input: 2025-Jan-16
# Groups: year=2025, month=Jan, day=16
(?<year>\d{4})-(?<month>[A-Za-z]{3})-(?<day>\d{2})

# Full Month Name
# Pattern: (?<month>[A-Za-z]+) (?<day>\d{1,2}), (?<year>\d{4})
# Input: January 16, 2025
# Groups: month=January, day=16, year=2025
(?<month>[A-Za-z]+) (?<day>\d{1,2}), (?<year>\d{4})

# ISO with Time
# Pattern: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})T(?<hour>\d{2}):(?<minute>\d{2})
# Input: 2025-01-16T14:30
# Groups: year=2025, month=01, day=16, hour=14, minute=30
(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})T(?<hour>\d{2}):(?<minute>\d{2})
TextregexSimple

Time Parsing Patterns

Extract time components (hour, minute, second) from various time formats

Difficulty

3/10

Estimated time

5 min

Tags

time, parsing, datetime, formatting

regex
# Time Parsing with Named Groups
# Extract hour, minute, second from time strings

# 24-Hour Format (HH:MM:SS)
# Pattern: (?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2})
# Input: 14:30:45
# Groups: hour=14, minute=30, second=45
(?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2})

# 12-Hour Format with AM/PM
# Pattern: (?<hour>\d{1,2}):(?<minute>\d{2}):(?<second>\d{2}) (?<ampm>[AP]M)
# Input: 2:30:45 PM
# Groups: hour=2, minute=30, second=45, ampm=PM
(?<hour>\d{1,2}):(?<minute>\d{2}):(?<second>\d{2}) (?<ampm>[AP]M)

# Hours and Minutes Only
# Pattern: (?<hour>\d{2}):(?<minute>\d{2})
# Input: 14:30
# Groups: hour=14, minute=30
(?<hour>\d{2}):(?<minute>\d{2})

# Time with Milliseconds
# Pattern: (?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2})\.(?<ms>\d{3})
# Input: 14:30:45.123
# Groups: hour=14, minute=30, second=45, ms=123
(?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2})\.(?<ms>\d{3})

# ISO 8601 Time
# Pattern: (?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2})(?<tz>[+-]\d{2}:\d{2})
# Input: 14:30:45+05:30
# Groups: hour=14, minute=30, second=45, tz=+05:30
(?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2})(?<tz>[+-]\d{2}:\d{2})
TextregexIntermediate

URL Parsing Patterns

Extract URL components (protocol, domain, path, query, fragment) from URLs

Difficulty

6/10

Estimated time

10 min

Tags

url, parsing, web, http

regex
# URL Parsing with Named Groups
# Extract protocol, domain, path, query, fragment from URLs

# Basic URL Structure
# Pattern: (?<protocol>https?)://(?<domain>[^/]+)(?<path>/[^?#]*)?(?:\?(?<query>[^#]*))?(?:#(?<fragment>.*))?
# Input: https://example.com/path/to/page?param=value#section
# Groups: protocol=https, domain=example.com, path=/path/to/page, query=param=value, fragment=section
(?<protocol>https?)://(?<domain>[^/]+)(?<path>/[^?#]*)?(?:\?(?<query>[^#]*))?(?:#(?<fragment>.*))?

# URL with Subdomain
# Pattern: (?<protocol>https?)://(?<subdomain>[^/.]+)\.(?<domain>[^/]+)(?<path>/.*)
# Input: https://blog.example.com/post/123
# Groups: protocol=https, subdomain=blog, domain=example.com, path=/post/123
(?<protocol>https?)://(?<subdomain>[^/.]+)\.(?<domain>[^/]+)(?<path>/.*)

# URL with Port
# Pattern: (?<protocol>https?)://(?<domain>[^/:]+):(?<port>\d+)(?<path>/.*)
# Input: http://localhost:8080/api/users
# Groups: protocol=http, domain=localhost, port=8080, path=/api/users
(?<protocol>https?)://(?<domain>[^/:]+):(?<port>\d+)(?<path>/.*)

# URL with Auth (rare)
# Pattern: (?<protocol>https?)://(?<user>[^:]+):(?<pass>[^@]+)@(?<domain>[^/]+)
# Input: https://admin:[email protected]
# Groups: protocol=https, user=admin, pass=password, domain=example.com
(?<protocol>https?)://(?<user>[^:]+):(?<pass>[^@]+)@(?<domain>[^/]+)

# Extract Domain Parts
# Pattern: (?<protocol>https?)://(?<subdomain>[^.]+)\.(?<domain>[^.]+)\.(?<tld>[^.]+)
# Input: https://www.example.com
# Groups: protocol=https, subdomain=www, domain=example, tld=com
(?<protocol>https?)://(?<subdomain>[^.]+)\.(?<domain>[^.]+)\.(?<tld>[^.]+)
TextregexIntermediate

Email Parsing Patterns

Extract email components (local part, domain, TLD) from email addresses

Difficulty

5/10

Estimated time

8 min

Tags

email, parsing, validation, contact

regex
# Email Parsing with Named Groups
# Extract local part, domain, and TLD from email addresses

# Basic Email Structure
# Pattern: (?<local>[^@]+)@(?<domain>[^.]+)\.(?<tld>[^@]+)
# Input: [email protected]
# Groups: local=user, domain=example, tld=com
(?<local>[^@]+)@(?<domain>[^.]+)\.(?<tld>[^@]+)

# Email with Subdomain
# Pattern: (?<local>[^@]+)@(?<subdomain>[^.]+)\.(?<domain>[^.]+)\.(?<tld>[^.]+)
# Input: [email protected]
# Groups: local=user, subdomain=mail, domain=example, tld=com
(?<local>[^@]+)@(?<subdomain>[^.]+)\.(?<domain>[^.]+)\.(?<tld>[^.]+)

# Email with Plus Tagging
# Pattern: (?<local>[^+]+)\+(?<tag>[^@]+)@(?<domain>[^.]+)\.(?<tld>[^@]+)
# Input: [email protected]
# Groups: local=user, tag=promo, domain=example, tld=com
(?<local>[^+]+)\+(?<tag>[^@]+)@(?<domain>[^.]+)\.(?<tld>[^@]+)

# Country Code TLD
# Pattern: (?<local>[^@]+)@(?<domain>[^.]+)\.(?<tld>[^.]+)\.(?<country>[a-z]{2})
# Input: [email protected]
# Groups: local=user, domain=example, tld=co, country=uk
(?<local>[^@]+)@(?<domain>[^.]+)\.(?<tld>[^.]+)\.(?<country>[a-z]{2})

# Academic Email
# Pattern: (?<local>[^@]+)@(?<department>[^.]+)\.(?<university>[^.]+)\.(?<tld>edu)
# Input: [email protected]
# Groups: local=student, department=cs, university=mit, tld=edu
(?<local>[^@]+)@(?<department>[^.]+)\.(?<university>[^.]+)\.(?<tld>edu)
TextregexComplex

Log File Parsing Patterns

Parse server log entries with timestamp, level, message, and metadata

Difficulty

7/10

Estimated time

12 min

Tags

logging, parsing, server, debugging

regex
# Log File Parsing with Named Groups
# Extract timestamp, level, logger, message from log entries

# Apache Common Log Format
# Pattern: (?<ip>\d+\.\d+\.\d+\.\d+) - (?<user>\S+) \[(?<timestamp>[^\]]+)\] "(?<method>\w+) (?<path>\S+) (?<protocol>\S+)" (?<status>\d+) (?<size>\d+)
# Input: 192.168.1.1 - - [16/Jan/2025:14:30:45 +0000] "GET /index.html HTTP/1.1" 200 1234
# Groups: ip=192.168.1.1, user=-, timestamp=16/Jan/2025:14:30:45 +0000, method=GET, path=/index.html, protocol=HTTP/1.1, status=200, size=1234
(?<ip>\d+\.\d+\.\d+\.\d+) - (?<user>\S+) \[(?<timestamp>[^\]]+)\] "(?<method>\w+) (?<path>\S+) (?<protocol>\S+)" (?<status>\d+) (?<size>\d+)

# Application Log Format
# Pattern: \[(?<timestamp>[^\]]+)\] (?<level>\w+) (?<logger>\S+) - (?<message>.*)
# Input: [2025-01-16 14:30:45] INFO com.example.Service - Request processed successfully
# Groups: timestamp=2025-01-16 14:30:45, level=INFO, logger=com.example.Service, message=Request processed successfully
\[(?<timestamp>[^\]]+)\] (?<level>\w+) (?<logger>\S+) - (?<message>.*)

# Error Log with Exception
# Pattern: \[(?<timestamp>[^\]]+)\] (?<level>ERROR) (?<logger>\S+) - (?<message>[^\[]+) \[(?<exception>[^\]]+)\]
# Input: [2025-01-16 14:30:45] ERROR com.example.Service - Database connection failed [SQLException: Connection timeout]
# Groups: timestamp=2025-01-16 14:30:45, level=ERROR, logger=com.example.Service, message=Database connection failed, exception=SQLException: Connection timeout
\[(?<timestamp>[^\]]+)\] (?<level>ERROR) (?<logger>\S+) - (?<message>[^\[]+) \[(?<exception>[^\]]+)\]

# Nginx Log Format
# Pattern: (?<ip>[^ ]*) - (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\w+) (?<path>[^ ]*) (?<protocol>[^"]*)" (?<status>\d+) (?<size>\d+) "(?<referrer>[^"]*)" "(?<ua>[^"]*)"
# Input: 127.0.0.1 - - [16/Jan/2025:14:30:45 +0000] "GET /api/users HTTP/1.1" 200 1234 "-" "Mozilla/5.0"
# Groups: ip=127.0.0.1, user=-, time=16/Jan/2025:14:30:45 +0000, method=GET, path=/api/users, protocol=HTTP/1.1, status=200, size=1234, referrer=-, ua=Mozilla/5.0
(?<ip>[^ ]*) - (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\w+) (?<path>[^ ]*) (?<protocol>[^"]*)" (?<status>\d+) (?<size>\d+) "(?<referrer>[^"]*)" "(?<ua>[^"]*)"
TextregexSimple

IP Address Parsing Patterns

Extract IP address octets and components from IPv4 addresses

Difficulty

4/10

Estimated time

6 min

Tags

network, ip, parsing, addressing

regex
# IP Address Parsing with Named Groups
# Extract octets from IPv4 addresses

# Standard IPv4
# Pattern: (?<octet1>\d{1,3})\.(?<octet2>\d{1,3})\.(?<octet3>\d{1,3})\.(?<octet4>\d{1,3})
# Input: 192.168.1.1
# Groups: octet1=192, octet2=168, octet3=1, octet4=1
(?<octet1>\d{1,3})\.(?<octet2>\d{1,3})\.(?<octet3>\d{1,3})\.(?<octet4>\d{1,3})

# IP with CIDR Notation
# Pattern: (?<octet1>\d{1,3})\.(?<octet2>\d{1,3})\.(?<octet3>\d{1,3})\.(?<octet4>\d{1,3})/(?<cidr>\d{1,2})
# Input: 192.168.1.0/24
# Groups: octet1=192, octet2=168, octet3=1, octet4=0, cidr=24
(?<octet1>\d{1,3})\.(?<octet2>\d{1,3})\.(?<octet3>\d{1,3})\.(?<octet4>\d{1,3})/(?<cidr>\d{1,2})

# IP with Port
# Pattern: (?<octet1>\d{1,3})\.(?<octet2>\d{1,3})\.(?<octet3>\d{1,3})\.(?<octet4>\d{1,3}):(?<port>\d{1,5})
# Input: 192.168.1.1:8080
# Groups: octet1=192, octet2=168, octet3=1, octet4=1, port=8080
(?<octet1>\d{1,3})\.(?<octet2>\d{1,3})\.(?<octet3>\d{1,3})\.(?<octet4>\d{1,3}):(?<port>\d{1,5})

# Network and Broadcast
# Pattern: (?<network>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/(?<cidr>\d{1,2}) (?:broadcast: (?<broadcast>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))
# Input: 192.168.1.0/24 broadcast: 192.168.1.255
# Groups: network=192.168.1.0, cidr=24, broadcast=192.168.1.255
(?<network>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/(?<cidr>\d{1,2}) (?:broadcast: (?<broadcast>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))
TextregexIntermediate

GPS Coordinates Parsing Patterns

Extract latitude and longitude from GPS coordinate formats

Difficulty

5/10

Estimated time

8 min

Tags

gps, coordinates, location, geography

regex
# GPS Coordinates Parsing with Named Groups
# Extract latitude and longitude from coordinate strings

# Decimal Degrees
# Pattern: (?<lat>-?\d+\.\d+),\s*(?<lon>-?\d+\.\d+)
# Input: 40.7128, -74.0060
# Groups: lat=40.7128, lon=-74.0060
(?<lat>-?\d+\.\d+),\s*(?<lon>-?\d+\.\d+)

# DMS Format (Degrees Minutes Seconds)
# Pattern: (?<lat_deg>\d+)°(?<lat_min>\d+)'(?<lat_sec>\d+(?:\.\d+)?)?" (?<lat_dir>[NS]), (?<lon_deg>\d+)°(?<lon_min>\d+)'(?<lon_sec>\d+(?:\.\d+)?)?" (?<lon_dir>[EW])
# Input: 40°42'55" N, 74°00'21" W
# Groups: lat_deg=40, lat_min=42, lat_sec=55, lat_dir=N, lon_deg=74, lon_min=00, lon_sec=21, lon_dir=W
(?<lat_deg>\d+)°(?<lat_min>\d+)'(?<lat_sec>\d+(?:\.\d+)?)?" (?<lat_dir>[NS]), (?<lon_deg>\d+)°(?<lon_min>\d+)'(?<lon_sec>\d+(?:\.\d+)?)?" (?<lon_dir>[EW])

# Degrees Decimal Minutes
# Pattern: (?<lat_deg>\d+)°(?<lat_min>\d+\.\d+)' (?<lat_dir>[NS]), (?<lon_deg>\d+)°(?<lon_min>\d+\.\d+)' (?<lon_dir>[EW])
# Input: 40°42.917' N, 74°00.350' W
# Groups: lat_deg=40, lat_min=42.917, lat_dir=N, lon_deg=74, lon_min=00.350, lon_dir=W
(?<lat_deg>\d+)°(?<lat_min>\d+\.\d+)' (?<lat_dir>[NS]), (?<lon_deg>\d+)°(?<lon_min>\d+\.\d+)' (?<lon_dir>[EW])

# Geo URI Format
# Pattern: geo:(?<lat>-?\d+\.\d+),(?<lon>-?\d+\.\d+)(?:\?z=(?<zoom>\d+))?
# Input: geo:40.7128,-74.0060?z=15
# Groups: lat=40.7128, lon=-74.0060, zoom=15
geo:(?<lat>-?\d+\.\d+),(?<lon>-?\d+\.\d+)(?:\?z=(?<zoom>\d+))?
TextregexIntermediate

Product Code Parsing Patterns

Extract product information from SKU, UPC, and product codes

Difficulty

6/10

Estimated time

10 min

Tags

product, sku, inventory, parsing

regex
# Product Code Parsing with Named Groups
# Extract category, SKU, variant from product codes

# Simple SKU
# Pattern: (?<category>[A-Z]{2})-(?<sku>\d{4})-(?<variant>[A-Z]{2})
# Input: EL-1234-LG
# Groups: category=EL, sku=1234, variant=LG
(?<category>[A-Z]{2})-(?<sku>\d{4})-(?<variant>[A-Z]{2})

# UPC-A Barcode
# Pattern: (?<system>\d{1})(?<mfg>\d{5})(?<product>\d{5})(?<check>\d{1})
# Input: 012345678901
# Groups: system=0, mfg=12345, product=67890, check=1
(?<system>\d{1})(?<mfg>\d{5})(?<product>\d{5})(?<check>\d{1})

# ISBN-13
# Pattern: (?<prefix>\d{3})-(?<group>\d{1,5})-(?<publisher>\d{1,7})-(?<title>\d{1,7})-(?<check>\d{1})
# Input: 978-0-306-40615-7
# Groups: prefix=978, group=0, publisher=306, title=40615, check=7
(?<prefix>\d{3})-(?<group>\d{1,5})-(?<publisher>\d{1,7})-(?<title>\d{1,7})-(?<check>\d{1})

# Color-Size Product Code
# Pattern: (?<product>[A-Z]{3})(?<size>XS|S|M|L|XL)(?<color>BL|RD|GR|BK)
# Input: TSHIRTLRDBL
# Groups: product=TSHIRT, size=L, color=RD
(?<product>[A-Z]{3})(?<size>XS|S|M|L|XL)(?<color>BL|RD|GR|BK)

# Hierarchical Product Code
# Pattern: (?<dept>\d{2})\.(?<class>\d{2})\.(?<item>\d{4})-(?<color>\d{2})
# Input: 10.20.1234-56
# Groups: dept=10, class=20, item=1234, color=56
(?<dept>\d{2})\.(?<class>\d{2})\.(?<item>\d{4})-(?<color>\d{2})
TextregexIntermediate

File Path Parsing Patterns

Extract directory, filename, and extension from file paths

Difficulty

5/10

Estimated time

8 min

Tags

file, path, filesystem, parsing

regex
# File Path Parsing with Named Groups
# Extract directory, filename, extension from file paths

# Unix Path
# Pattern: (?<dir>/[^/]*)/(?<file>[^/]+)\.(?<ext>[^.]+)
# Input: /home/user/documents/report.pdf
# Groups: dir=/home/user/documents, file=report, ext=pdf
(?<dir>/[^/]*)/(?<file>[^/]+)\.(?<ext>[^.]+)

# Windows Path
# Pattern: (?<drive>[A-Z]:)\\(?<dir>[^\\]+)\\(?<file>[^\\]+)\.(?<ext>[^.]+)
# Input: C:\\Users\\Admin\\Documents\\report.docx
# Groups: drive=C:, dir=Users\Admin\Documents, file=report, ext=docx
(?<drive>[A-Z]:)\\(?<dir>[^\\]+)\\(?<file>[^\\]+)\.(?<ext>[^.]+)

# URL Path
# Pattern: https?://[^/]+(?<path>/[^/]+/)(?<file>[^/]+)\.(?<ext>[^.]+)
# Input: https://example.com/downloads/images/photo.jpg
# Groups: path=/downloads/images/, file=photo, ext=jpg
https?://[^/]+(?<path>/[^/]+/)(?<file>[^/]+)\.(?<ext>[^.]+)

# Hidden File (Unix)
# Pattern: (?<dir>/[^/]*)/(?<hidden>\.(?<file>[^/]+))\.(?<ext>[^.]+)
# Input: /home/user/.bashrc.backup
# Groups: dir=/home/user, hidden=.bashrc, file=bashrc, ext=backup
(?<dir>/[^/]*)/(?<hidden>\.(?<file>[^/]+))\.(?<ext>[^.]+)

# Versioned Filename
# Pattern: (?<file>[^-]+)-(?<version>\d+\.\d+\.\d+)\.(?<ext>[^.]+)
# Input: myapp-2.1.0.tar.gz
# Groups: file=myapp, version=2.1.0, ext=tar.gz
(?<file>[^-]+)-(?<version>\d+\.\d+\.\d+)\.(?<ext>[^.]+)
TextregexComplex

Person Name Parsing Patterns

Parse person names into title, first name, middle name, last name, and suffix

Difficulty

7/10

Estimated time

12 min

Tags

name, parsing, personal, formatting

regex
# Person Name Parsing with Named Groups
# Parse names into title, first, middle, last, suffix

# Full Name with Title
# Pattern: (?<title>Mr|Mrs|Ms|Dr|Prof)\.? (?<first>[A-Z][a-z]+) (?<last>[A-Z][a-z]+)
# Input: Dr. John Smith
# Groups: title=Dr, first=John, last=Smith
(?<title>Mr|Mrs|Ms|Dr|Prof)\.? (?<first>[A-Z][a-z]+) (?<last>[A-Z][a-z]+)

# Name with Middle Initial
# Pattern: (?<first>[A-Z][a-z]+) (?<middle>[A-Z])\. (?<last>[A-Z][a-z]+)
# Input: John A. Smith
# Groups: first=John, middle=A, last=Smith
(?<first>[A-Z][a-z]+) (?<middle>[A-Z])\. (?<last>[A-Z][a-z]+)

# Name with Suffix
# Pattern: (?<first>[A-Z][a-z]+) (?<last>[A-Z][a-z]+) (?<suffix>Jr|Sr|II|III|IV)
# Input: Robert Smith Jr
# Groups: first=Robert, last=Smith, suffix=Jr
(?<first>[A-Z][a-z]+) (?<last>[A-Z][a-z]+) (?<suffix>Jr|Sr|II|III|IV)

# Full Name with Middle Name
# Pattern: (?<first>[A-Z][a-z]+) (?<middle>[A-Z][a-z]+) (?<last>[A-Z][a-z]+)
# Input: William Henry Harrison
# Groups: first=William, middle=Henry, last=Harrison
(?<first>[A-Z][a-z]+) (?<middle>[A-Z][a-z]+) (?<last>[A-Z][a-z]+)

# Last, First Format
# Pattern: (?<last>[A-Z][a-z]+), (?<first>[A-Z][a-z]+)(?: (?<middle>[A-Z][a-z]+))?
# Input: Smith, John Henry
# Groups: last=Smith, first=John, middle=Henry
(?<last>[A-Z][a-z]+), (?<first>[A-Z][a-z]+)(?: (?<middle>[A-Z][a-z]+))?
TextregexComplex

Credit Card Parsing Patterns

Extract card components (BIN, account, check digit) from credit card numbers

Difficulty

8/10

Estimated time

10 min

Tags

payment, credit card, financial, validation

regex
# Credit Card Parsing with Named Groups
# Extract BIN, account number, and check digit from card numbers

# Visa Card (16 digits)
# Pattern: (?<network>4)(?<bin>\d{4})(?<account>\d{8})(?<check>\d{4})
# Input: 4532015112830366
# Groups: network=4, bin=4532, account=01511283, check=0366
(?<network>4)(?<bin>\d{4})(?<account>\d{8})(?<check>\d{4})

# Mastercard (16 digits)
# Pattern: (?<network>5[1-5])(?<bin>\d{3})(?<account>\d{9})(?<check>\d{3})
# Input: 5555555555554444
# Groups: network=55, bin=555, account=555555555, check=444
(?<network>5[1-5])(?<bin>\d{3})(?<account>\d{9})(?<check>\d{3})

# Amex (15 digits)
# Pattern: (?<network>3[47])(?<bin>\d{4})(?<account>\d{7})(?<check>\d{4})
# Input: 378282246310005
# Groups: network=37, bin=8282, account=2463100, check=0005
(?<network>3[47])(?<bin>\d{4})(?<account>\d{7})(?<check>\d{4})

# Formatted Card Number
# Pattern: (?<network>\d{4})-(?<bin>\d{4})-(?<account>\d{4})-(?<check>\d{4})
# Input: 4532-0151-1283-0366
# Groups: network=4532, bin=0151, account=1283, check=0366
(?<network>\d{4})-(?<bin>\d{4})-(?<account>\d{4})-(?<check>\d{4})

# Card with Expiry and CVV
# Pattern: (?<number>\d{16}) Exp: (?<expiry>\d{2}/\d{2}) CVV: (?<cvv>\d{3,4})
# Input: 4532015112830366 Exp: 12/25 CVV: 123
# Groups: number=4532015112830366, expiry=12/25, cvv=123
(?<number>\d{16}) Exp: (?<expiry>\d{2}/\d{2}) CVV: (?<cvv>\d{3,4})
TextregexIntermediate

Semantic Version Parsing Patterns

Parse semantic version strings into major, minor, patch, and pre-release components

Difficulty

6/10

Estimated time

10 min

Tags

version, semver, parsing, release

regex
# Semantic Version Parsing with Named Groups
# Parse major, minor, patch, pre-release, build from version strings

# Basic SemVer
# Pattern: v?(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)
# Input: v2.1.0
# Groups: major=2, minor=1, patch=0
v?(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)

# SemVer with Pre-release
# Pattern: v?(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<pre>[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?
# Input: 2.0.0-alpha.1
# Groups: major=2, minor=0, patch=0, pre=alpha.1
v?(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<pre>[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?

# SemVer with Build Metadata
# Pattern: v?(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<pre>[0-9A-Za-z-]+))?(?:\+(?<build>[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?
# Input: 1.4.2-beta+exp.sha.5114f85
# Groups: major=1, minor=4, patch=2, pre=beta, build=exp.sha.5114f85
v?(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<pre>[0-9A-Za-z-]+))?(?:\+(?<build>[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?

# Package Version
# Pattern: (?<name>[a-z]+)@(?<version>\d+\.\d+\.\d+)
# Input: [email protected]
# Groups: name=package, version=2.1.0
(?<name>[a-z]+)@(?<version>\d+\.\d+\.\d+)

# Version Range
# Pattern: (?<min>\d+\.\d+\.\d+) - (?<max>\d+\.\d+\.\d+)
# Input: 1.0.0 - 2.0.0
# Groups: min=1.0.0, max=2.0.0
(?<min>\d+\.\d+\.\d+) - (?<max>\d+\.\d+\.\d+)

Tools

Tools frequently paired with this sample

Related

Related sample collections

Related

Related workflows

Hub

Regex Testing, Visualization, and Safety Workflow

Build reliable regular expressions by learning syntax, testing matches, visualizing structure, previewing replacements, benchmarking alternatives, and scanning for ReDoS risk.

Hub

Text Encoding, Width, Date, and Currency Conversion Workflow

Prepare imported or copied text for reuse by recovering its encoding, choosing a character-width convention, standardizing inline dates or currency, and selecting a final text representation.

Hub

Deliberate Text Corruption and Mutation for Testing

Break clean text on purpose — filter, duplicate, and reverse sentences and words, inject random letters and symbols, shuffle lines and words, and prove every mutation stays controlled for parser stress tests, OCR rehearsal, and language experiments.

Hub

Texture, Grain, Pattern, and Reflection Overlays for Images

Dress a finished image with material character — mask where the effect applies, add film grain or surface texture, overlay geometric patterns, and extend the composition with water reflections.

Home
Tools3211
Samples593
Visualizations471
Viewers103
Hubs239
Tags333
Images, Audio & Video657

Image, audio, and video processing, conversion, and optimization tools

Math, Date & Finance647

Calculators, numerics, date logic, statistics, and finance tools

Design & Color298

Color, layout, graphics, visual styling, and design helper tools

Text & Writing209

Writing, cleanup, formatting, extraction, and text analysis tools

Developer & Web193

Developer utilities, networking, web debugging, and automation helpers

Conversion & Encoding175

Format, file, archive, unit, and encoding conversion tools

Lead Generation Quiz Launch and Contact Handoff
Memorial Drafts: Family Review and Print Handoff
Private Habit Records: Backup, Restore and Sharing Review
Article to X and LinkedIn Drafts: Fact Review and Handoff
Markdown Interactive Deck Review and Offline Handoff

© 2026 Elysia Tools. All rights reserved.

DocsPricingAboutTerms of ServicePrivacy PolicyCookiesContact

Media

Audio Cutter

Cut and extract audio clips from audio files with precise time selection

Media

DTMF Decoder

Detect DTMF touch-tone digits in any recording and recover the keypad sequence with timestamps. Goertzel filter bank per ITU-T Q.23/Q.24 — measures both tone frequencies, twist and duration for every keypress.

Media

Audio Melody Contour Extractor

Extract a dominant melody path from audio and export MIDI, note events, a pitch contour, SVG, and JSON in one ZIP.

Media

Audio Mixer

Mix two audio files together with customizable timing control

Media

Audio Noise Floor Timeline

Track a heuristic low-level RMS proxy over time, with separate digital-silence counts and per-channel change flags.

Media

Audio Null Test

Compare two audio files by direct sample subtraction and export residual measurements.

Media

Audio Speed Changer

Change audio playback speed while maintaining original pitch using time-stretching algorithms

Media

FFmpeg Audio Noise Reduction

Professional audio noise reduction using FFmpeg advanced filters (highpass, afftdn, loudnorm) for optimal audio cleaning

C#

Windows Web Features - C# Samples

Comprehensive C# web features examples for Windows platform including routing, middleware, and static file serving

DevOps

ELK Stack Log Analysis Samples

Comprehensive ELK Stack (Elasticsearch, Logstash, Kibana) samples for log aggregation, processing, and visualization in distributed systems

Data Formats

Environment Variables (.env) Samples

Environment variables configuration examples for different application types and environments

Objective-C

macOS Web Features Objective-C Samples

macOS Objective-C web features examples including URL routing, middleware, and static file serving

C#

Windows Error Handling - C# Samples

Comprehensive C# error handling examples for Windows platform including exception handling, logging, and parameter validation

C++

Windows Web Features C++ Samples

Windows C++ web server development examples including URL routing, middleware, and static file serving