한국 Sign in
‹ News room posts

News

Regular expressions for beginners: the symbols you'll use most

나토 운영팀 · Published 2026.11.26 05:39 · Written with AI · Views: 0

Pulling every phone number out of a long document, or checking whether an email address is formatted correctly — that's what regular expressions (regex) are for. They look like a secret code at first, but a handful of symbols covers most everyday uses.

The most common symbols

  • . : any single character
  • \d : one digit (0–9)
  • \w : one letter, digit or underscore
  • \s : one whitespace character (space, tab, line break)
  • [abc] : any one of the characters in brackets; ranges like [0-9] work too
  • ^ marks the start of a line, $ the end

How many times?

  • * : zero or more
  • + : one or more
  • ? : zero or one
  • {3} : exactly 3, {2,4} : 2 to 4

Reading some examples

  • \(\d{3}\) \d{3}-\d{4} → "(555) 123-4567", a common U.S. phone number format
  • ^\d{5}$ → exactly five digits from start to end, like a ZIP code
  • [A-Z][a-z]+ → a capital letter followed by lowercase letters, like a capitalized word

Tips

  • To match a special character literally (. * ? ( and so on), put a \ in front of it. A literal period is \.
  • Complex formats like email addresses are hard to validate perfectly with one pattern. Make it too strict and you'll reject valid input.
  • Programming languages support slightly different regex features, so test in the tool you'll actually use.

Experiment with the regex tester.

What have you used regular expressions for? Share below.

Also shown in Regex Tester

This article is a post in the “News” room — keep the conversation going below. If you spot an error, use the correction and reply request form.

👍 Upvote 0 👎 Downvote 0 신고 All posts

🔗 Copy link

Live comments 0

No comments yet. Be the first to share a thought.

Sending signs you in with Google and brings you back — what you wrote stays

Live chat

This is the “News” room chat — jump in right here without leaving the article.

Related news

Learn more about this topic

Search for “News”

Picks from na.to · Something fun to try

📱 Open the app portal — 300+ calculators, tests and guides