<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/regex-cheat-sheet-y3o9n5laz" -->

---
title: Regex Cheat Sheet | daily.dev
description: Use character classes, which allow you to define a group of characters you wish to match You place them inside square brackets. To test for a match of...
canonical: https://daily.dev/posts/regex-cheat-sheet-y3o9n5laz
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Regex Cheat Sheet | daily.dev
og:description: Use character classes, which allow you to define a group of characters you wish to match You place them inside square brackets. To test for a match of...
og:url: https://daily.dev/posts/regex-cheat-sheet-y3o9n5laz
og:image: https://api.daily.dev/og/posts/Y3o9N5laz.png
og:image:alt: Regex Cheat Sheet
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Regex Cheat Sheet

**[Community Picks](https://daily.dev/sources/community)** · 4 min read · 134 upvotes · 4 comments

## Summary

Use character classes, which allow you to define a group of characters you wish to match You place them inside square brackets. To test for a match of characters at the beginning of a string, use the caret ^, but outside of the character set const emmaAtFrontOfString = " Emma likes cats a lot.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://dev.to/emmabostian/regex-cheat-sheet-2j2a>

## Community discussion

Top comments from developers on daily.dev.

**@lorezz** · 1 upvotes

> Very useful, a lot of examples. Well done

**@lorezz** · 0 upvotes

> Very useful, a lot of examples. We'll done

**@devvsakib** · 0 upvotes

> one of the best article, time saving. can bookmark

**@kdavid** · 0 upvotes

> Regex is awesome and hard. You have to keep on practicing to actually remember everything

---

[View this post on daily.dev](https://daily.dev/posts/regex-cheat-sheet-y3o9n5laz)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Regex Cheat Sheet","url":"https://daily.dev/posts/regex-cheat-sheet-y3o9n5laz","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/regex-cheat-sheet-y3o9n5laz"},"datePublished":"2022-08-15T12:37:55.448Z","dateModified":"2023-12-07T12:02:45.284Z","description":"Use character classes, which allow you to define a group of characters you wish to match You place them inside square brackets. To test for a match of...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8aa41403f1f0dc514606ff6470233bcb","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8aa41403f1f0dc514606ff6470233bcb","isAccessibleForFree":true,"articleSection":"Community Picks","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Community Picks","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1655817725/logos/community","url":"https://daily.dev/sources/community"},"commentCount":4,"discussionUrl":"https://daily.dev/posts/regex-cheat-sheet-y3o9n5laz","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":134},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":4}],"keywords":"","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Community Picks","item":"https://daily.dev/sources/community"},{"@type":"ListItem","position":3,"name":"Regex Cheat Sheet"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/regex-cheat-sheet-y3o9n5laz","comment":[{"@type":"Comment","text":"Very useful, a lot of examples. Well done","datePublished":"2022-08-16T07:12:19.753Z","dateModified":"2022-08-16T07:13:21.845Z","url":"https://daily.dev/posts/Y3o9N5laz#c-gHI-C_ZO7","author":{"@type":"Person","name":"lorezz","url":"https://daily.dev/lorezz","image":"https://avatars0.githubusercontent.com/u/1153066?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Very useful, a lot of examples. We’ll done","datePublished":"2022-08-16T07:12:18.369Z","url":"https://daily.dev/posts/Y3o9N5laz#c-ytzbs9Vwa","author":{"@type":"Person","name":"lorezz","url":"https://daily.dev/lorezz","image":"https://avatars0.githubusercontent.com/u/1153066?v=4"}},{"@type":"Comment","text":"one of the best article, time saving. can bookmark","datePublished":"2022-09-03T17:26:19.981Z","url":"https://daily.dev/posts/Y3o9N5laz#c-CMHa3gelL","author":{"@type":"Person","name":"Sakib Ahmed","url":"https://daily.dev/devvsakib","image":"https://avatars.githubusercontent.com/u/88339569?v=4"}},{"@type":"Comment","text":"Regex is awesome and hard. You have to keep on practicing to actually remember everything","datePublished":"2022-08-17T17:35:14.651Z","url":"https://daily.dev/posts/Y3o9N5laz#c-JDFZWO2AA","author":{"@type":"Person","name":"King David","url":"https://daily.dev/kdavid","image":"https://media.daily.dev/image/upload/v1670416408/avatars/avatar_czGxy5fezmSEtrl2dHIV0.jpg"}}]}
```

