Revisスニペット集
ビジュアライザー →

正規表現スニペット集

コピペですぐ使える正規表現パターン集。日本語(ひらがな・カタカナ・漢字・郵便番号など)と英語に対応。JavaScript・Python・Goのサンプルコード付き。

50 件 ·日本語 11 ·英語 39

日本語の正規表現

ひらがなにマッチする正規表現
/[\u3041-\u3096]/
日本語のひらがな(あ〜ん)にマッチする正規表現パターンです。
カタカナにマッチする正規表現
/[\u30A1-\u30FA]/
日本語のカタカナ(ア〜ン)にマッチする正規表現パターンです。
日本の郵便番号にマッチする正規表現
/\d{3}-\d{4}/
日本の郵便番号(例:123-4567)にマッチする正規表現です。
日本の電話番号にマッチする正規表現
/0\d{1,4}-\d{1,4}-\d{.../
日本の電話番号(例:090-1234-5678)にマッチする正規表現です。
漢字にマッチする正規表現
/[\u4E00-\u9FFF]+/
日本語の漢字(CJK統合漢字)にマッチする正規表現パターンです。
全角数字にマッチする正規表現
/[\uFF10-\uFF19]+/
全角数字(0〜9)にマッチする正規表現パターンです。
全角英字にマッチする正規表現
/[\uFF21-\uFF3A\uFF41.../
全角アルファベット(A〜Z、a〜z)にマッチする正規表現パターンです。
日本語の日付にマッチする正規表現
/\d{4}年\d{1,2}月\d{1,2.../
YYYY年MM月DD日 形式の日付にマッチする正規表現です。
都道府県にマッチする正規表現
/東京都|北海道|(?:大阪|京都)府|..../
日本の都道府県名にマッチする正規表現パターンです。
日本人名(姓名)にマッチする正規表現
/[\u4E00-\u9FFF]{1,4}.../
漢字2〜4文字の日本人名にマッチする正規表現パターンです。
元号(令和・平成など)にマッチする正規表現
/(?:令和|平成|昭和|大正|明治)\d.../
日本の元号(令和・平成・昭和・大正・明治)と年数にマッチする正規表現です。

英語の正規表現

Email Address Regex
/[a-zA-Z0-9._%+\-]+@[.../
Matches standard email addresses like user@example.com.
URL Regex
/https?:\/\/(www\.)?[.../
Matches http and https URLs.
Credit Card Number Regex
/(?:4[0-9]{12}(?:[0-9.../
Matches major credit card numbers (Visa, Mastercard, Amex) with or without dashes.
IPv4 Address Regex
/\b(?:(?:25[0-5]|2[0-.../
Matches valid IPv4 addresses like 192.168.1.1.
Hex Color Code Regex
/#(?:[0-9a-fA-F]{3}){.../
Matches CSS hex color codes like #fff or #ffffff.
URL Slug Regex
/^[a-z0-9]+(?:-[a-z0-.../
Matches URL-friendly slugs using lowercase letters, numbers, and hyphens.
Strong Password Regex
/^(?=.*[a-z])(?=.*[A-.../
Matches passwords with at least 8 chars, uppercase, lowercase, number, and special character.
Semantic Version Regex
/\bv?(?:0|[1-9]\d*)\..../
Matches semantic versioning strings like 1.0.0 or 2.3.1-beta.
JWT Token Regex
/eyJ[A-Za-z0-9_-]+\.e.../
Matches JSON Web Tokens (three base64url segments separated by dots).
Markdown Link Regex
/\[([^\]]+)\]\((https.../
Matches Markdown hyperlinks in [text](url) format.
HTML Tag Regex
/<\/?[a-zA-Z][a-zA-Z0.../
Matches HTML opening and closing tags.
ISO 8601 Date Regex
/\b\d{4}-(0[1-9]|1[0-.../
Matches ISO 8601 date format: YYYY-MM-DD.
Time Format Regex (HH:MM)
/\b([01]\d|2[0-3]):([.../
Matches 24-hour time format like 09:30 or 23:59.
File Extension Regex
/\.(jpe?g|png|gif|web.../
Matches common file extensions like .jpg, .png, .pdf, .js.
Git Commit Hash Regex
/\b[0-9a-f]{7,40}\b/
Matches full (40-char) or short (7-char) Git commit hashes.
Log Level Regex
/\b(DEBUG|INFO|WARN(?.../
Matches common log levels: DEBUG, INFO, WARN, ERROR, FATAL.
MAC Address Regex
/\b([0-9A-Fa-f]{2}[:-.../
Matches MAC addresses in colon or hyphen notation.
US Phone Number Regex
/\b(?:\+1[-.\s]?)?(?:.../
Matches US phone numbers in various formats.
UUID Regex
/\b[0-9a-f]{8}-[0-9a-.../
Matches UUID v4 format strings.
Base64 String Regex
/\b[A-Za-z0-9+/]{4}(?.../
Matches Base64 encoded strings.
Environment Variable Regex
/^([A-Z_][A-Z0-9_]*)=.../
Matches environment variable declarations like KEY=value.
Twitter / X Mention Regex
/@([A-Za-z0-9_]{1,15}.../
Matches @username mentions in tweets or social posts.
Hashtag Regex
/#([A-Za-z0-9_]+)/
Matches hashtags used in social media posts.
DOI (Academic Paper) Regex
/\b10\.\d{4,9}/[-._;(.../
Matches Digital Object Identifiers used in academic publications.
SQL Injection Pattern Regex
/(?:'[^']*'|--|;|\b(?.../
Detects common SQL injection patterns for input validation.
camelCase to snake_case Regex
/([A-Z])/
Matches uppercase letters in camelCase for conversion to snake_case.
Content Between HTML Tags Regex
/<(\w+)[^>]*>([^<]+)<.../
Extracts text content between opening and closing HTML tags.
Repeated Words Regex
/\b(\w+)\s+\1\b/
Detects consecutive duplicate words in text.
Positive Lookahead Regex
/\w+(?=\s+dollars)/
Matches words followed by a specific pattern using positive lookahead.
Negative Lookahead Regex
/\b\d+(?!\s*px)\b/
Matches words NOT followed by a specific pattern using negative lookahead.
Named Capture Group Regex
/(?<year>\d{4})-(?<mo.../
Uses named groups to extract year, month, day from a date string.
Non-Greedy Match Regex
/<.+?>/
Uses non-greedy quantifier to match the shortest possible string.
Multiline Mode Regex
/^\d+\.\s.+$/
Uses multiline flag to match start/end of each line.
Korean Characters Regex
/[\uAC00-\uD7A3]+/
Matches Korean Hangul characters.
Arabic Characters Regex
/[\u0600-\u06FF]+/
Matches Arabic script characters.
Whitespace Normalization Regex
/\s{2,}/
Matches multiple consecutive whitespace characters for normalization.
Empty Lines Regex
/^\s*$/
Matches empty or whitespace-only lines for removal.
International Phone Number Regex
/\+?[1-9]\d{0,2}[\s.-.../
Matches international phone numbers with country codes.
Currency Amount Regex
/[$€£¥]\s?\d{1,3}(?:,.../
Matches currency amounts with optional symbol and decimal.
正規表現をリアルタイムでテストしたいですか?
Revisの正規表現ビジュアライザーで鉄道図・マッチハイライトを確認できます
ビジュアライザーを使う →
プライバシーポリシー