Online regular expression testing tool| Match/Replace/Generate Code- GoTool Online Toolset

开发工具指南

This tool provides an online regular expression tool that supports text substitution, matching, Go code generation, and provides descriptions of common expressions.

使用说明

🌟 documentation

📌 basic character

symbol description example matching content
. match any single character (except newline characters) a.b aab, acb
\ d match any numeric character[0-9] \ d\ d 12, 34
\ D match any non-numeric character[^ 0-9] \ D\ D ab, xy
\ w match letters, numbers or underscores[a-zA-Z0-9 _] \ w\ w\ w abc, 123
\ W match any non-alphanumeric or underscore characters \ W\ W !, @ @
\ s match white space characters (spaces, tabs, line feeds, etc.) \ s spaces, tabs
\ S match any non-blank character \ S\ S\ S abc, 123

📏 quantity qualifier

symbol description example matching content
* match the preceding character for zero or more times {0,} a* empty string, a, aa
+ match the preceding characters one or more times a+ a, aa, aaa
? match the preceding characters zero times or once, {0recover1} a? empty string, a
{n} match the preceding character exactly n times a {3} aaa
{n,} match the preceding characters at least n times a {2,} aa, aaa
{nrecast m} match the preceding characters at least n times, up to m times a {2pm 4} aa, aaa, aaa

🚩 boundary match

symbol description example matching content
^ the beginning of the matching string ^ Hello Hello in Hello!`
$ match the end of the string Worldmatch $ World! in Hello World!
\ b match word boundary \ bword\ b word in word
\ B match non-word boundaries \ Bword\ B word in passwords

🎯 grouping and referencing

symbol description example matching content
() capture group and save the matching substrings as a group (abc) + abc, abcabc
(?:...) non-capture group, only grouping but not saving substrings (?: abc) + abc, abcabc
\ n reference capture group. n is the group number (a) (b)\ 1\ 2 abab

🔍 character set and character class

symbol description example matching content
[abc] matches any character in a, b or c [abc] a, b, c
[^ abc] match any character except a, b or c [^ abc] d, e
[aMusz] match any lowercase letter from a to z [aripz] a, b, c
[Amurz] match any uppercase letter from A to Z [Amurz] A, B, C
[0-9] match any numeric character [0-9] 1, 2, 3

example of 📚 common mode

description regular expression sample data matching result
📞 matches phone number \ (\ d {3}\)\ d {3} -\ d {4} (123) 456-7890 match
📧 verifies email address ^ [A-Za-z0-9.9% address -] + @ [A-Za-z0-9.9 -] +\. [A-Za-z] {2,} $ example@ example.com match
📅 match date format ^\ d {4} -\ d {2} -\ d {2} $ 2024-08-17 match
🌐 matches IP address `^ ((25 [0-5] 2 [0-4] [0-9] [01]? [0-9] [0-9]?).) {3} (25 [0-5]
🔗 match URL ^ https?:\ /\ / [^\ sUniverse. Match #] .[ ^\ s] * $ https://www.example.com match
🏷️ matches HTML tags < (\ /? [^ >] +) > < div >, < / div > match
📮 matches Postal Code ^\ d {5} (-\ d {4})? $ 12345, 12345-6789 match
CSS color code extracted by 🎨 `# ([a-fA-F0-9] {6} [a-fA-F0-9] {3})` # ffffff, # fff

⚠️ escape character

symbol description example matching content
\ escape character, which is used to match characters with special meaning \ . match period .