whoareu@lemmy.ca to Programming@programming.devEnglish · 5 months agolast time when did you use Regular Expressions?message-squaremessage-square33fedilinkarrow-up127arrow-down12
arrow-up125arrow-down1message-squarelast time when did you use Regular Expressions?whoareu@lemmy.ca to Programming@programming.devEnglish · 5 months agomessage-square33fedilink
minus-squareDropkick3038@programming.devlinkfedilinkarrow-up1·edit-25 months agoregexes are a well established solution for parsing strings. what exactly is the “proper” alternative you propose?
minus-squarespartanatreyu@programming.devlinkfedilinkarrow-up1·5 months agoThere are some tools/libraries that act as a front-layer over regex. They basically follow the same logic as ORMs for databases: Get rid of the bottom layer to make some hidden footguns harder to trigger 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)
regexes are a well established solution for parsing strings. what exactly is the “proper” alternative you propose?
There are some tools/libraries that act as a front-layer over regex.
They basically follow the same logic as ORMs for databases:
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
)