News for hackers. Stuff that matters.
Re:Ask HN: What's the most valuable thing you can learn in a... by agungsukma on Wednesday November 20, 2019 @01:31AM (#21581564)
Yes, regular expression. Saves me from lines of substr, split, join, etc.
Re:Ask HN: What's the most valuable thing you can learn in a... by enraged_camel on Wednesday November 20, 2019 @05:00AM (#21582502)
Eh, I always use substr, split and so on if possible. They make the code way easier to read than with a regex.
Re:Ask HN: What's the most valuable thing you can learn in a... by Izkata on Wednesday November 20, 2019 @04:00PM (#21588453)
It really depends on what you're doing, and at least being aware of what regex can do will help with deciding which is better for a given situation.

For example, I remember once replacing a buggy 3-4 lines of python based on split/etc with a single regex: match all \d+ (it was for extracting IDs from a user-input string)