Home >Learn

Common Regular Expression Grammar Quick Reference Table

Published Updated
ExpressionName/DescriptionExampleMatches
.Any single character except newlinea.baab, acb, a b
[aeiou]Character set: matches any one character inside brackets[aeiou]a, e, I
[^0-9]Negated set: matches any character **not** inside brackets[^0-9]a, #, (space)
\dMatches any digit. Same as `[0-9]`\d0, 1, 9
\wMatches any word character. Same as `[a-zA-Z0-9_]`\wa, B, 5, _
\sMatches any whitespace (space, tab, form-feed, etc.)\s`, \t, \n
^Matches the **start** of the string^hellohello world
$Matches the **end** of the stringworld$hello world
*Matches preceding element **zero or more** timesa*"" (empty), a, aaa
+Matches preceding element **one or more** timesa+a, aaa
?Matches preceding element **zero or one** timea?"" (empty), a
{n}Matches preceding element exactly **n** times\d{3}123, 456
{n,}Matches preceding element **at least n** times\d{2,}12, 123, 1234
{n,m}Matches preceding element **at least n but no more than m** times\d{2,4}12, 1234
( )**Group**, treats expression inside as a single unit(ab)+ab, abab

Common Examples

Email Address

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

Phone Number (CN)

^1[3-9]\d{9}$

ID Card (CN)

^\d{15}$ |\d{18}$

Common Modifiers

i (case-insensitive)

Ignores case while matching. /hello/i matches Hello, HELLO, hello.

g (global)

Finds all matches, not just the first. /a/g matches three 'a's in 'banana'.

m (multiline)

Makes `^` and `$` match line start/end instead of string start/end.

s (single-line/dot-all)

Makes `.` match newlines as well.

Usage Tips

Use online tools (like RegexToolBox) to test and debug patterns in real time. Start simple and build up complexity. Remember to escape backslashes in string literals depending on your programming language.

目次

情報

  • ヒット2478
  • 公開日2025/10/12
0/500
敬意をもってご意見をお聞かせください。

もっと投稿

このセクションの記事をさらに探索
フィードバックメール