25
you are viewing a single comment's thread
view the rest of the comments
[-] Dropkick3038@programming.dev 1 points 1 month ago* (last edited 1 month ago)

regexes are a well established solution for parsing strings. what exactly is the "proper" alternative you propose?

[-] spartanatreyu@programming.dev 1 points 1 month ago

There are some tools/libraries that act as a front-layer over regex.

They basically follow the same logic as ORMs for databases:

  1. Get rid of the bottom layer to make some hidden footguns harder to trigger
  2. Make the used layer closer to the way the surrounding language is used.

But there's no common standard, and it's always language specific.

Personally I think using linters is the best option since it will highlight the footguns and recommend simpler regexes. (e.g. Swapping [0-9] for \d)

this post was submitted on 04 Jul 2024
25 points (93.1% liked)

Programming

16687 readers
206 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS