DEV Community

Guilherme Samuel
Guilherme Samuel

Posted on • Originally published at guilhermefront.com

1

ChatGPT is a regex god

ChatGPT can give you statements that either:

  1. Sounds very truthful, but has something wrong with it
  2. Is surprisingly good and accurate

With Regex questions, it seems to weigh way more on the latter.

image

A few examples:

  1. Match a Reddit post URL
    Reddit post url ChatGPT response

  2. Match a Twitter reply
    Twitter reply ChatGPT response

  3. Match a document format from a country
    ChatGPT response

  4. Match any email address that ends with "gmail.com" and contains a plus sign (+) followed by any combination of alphanumeric characters before the @ symbol
    ChatGPT response

  5. Match any phone number in the format (XXX) XXX-XXXX where the first three digits cannot be 555
    ChatGPT response

Be careful, it's prone to mistakes, so it's always a good idea to test it on an app like https://regex101.com/

Overall, I feel like most of the generated regular expressions are already going to be good enough to save some valuable minutes of your life.

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay