you are viewing a single comment's thread
view the rest of the comments
[–] 13 points 2 years ago (1 child)

You always forget regex syntax?

I've always found it simple to understand and remember. Even over many years and decades, I've never had issues reading or writing simple regex syntax (excluding the flags and shorthands) even after long regex breaks.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 16 points 2 years ago (5 children)

    It's not about the syntax itself, it's about which syntax to use. There are different ones and remembering which one is for which language is tough.

  • source
  • parent
  • hideshow 10 child comments
  • [–] 3 points 2 years ago

    This is exactly it. Regex is super simple. The difficulty is maintaining a mental mapping between language/util <-> regex engine <-> engine syntax & character class names. It gets worse when utils also conditionally enable extended syntaxes with flags or options.

    The hardest part is remembering whether you need to use \w or [:alnum:].

    Way too few utils actually mention which syntax they use too. Most just say something accepts a "regular expression", which is totally ambiguous.

  • source
  • parent
  • [–] 2 points 2 years ago* (1 child)

    I give you that, true. I wish vim had PCRE

  • source
  • parent
  • hideshow 2 child comments
  • [–] 0 points 2 years ago

    There is the "very magic" mode for vim regexes. It's not the exact PCRE syntax, but it's pretty close. You only need to add \v before the expression to use it. There is no permanent mode / option though. (I think you can remap the commands, like / to /\v)

  • source
  • parent
  • [–] 1 point 2 years ago

    This is exactly it. Regex is super simple. The difficulty is maintaining a mental mapping between language/util <-> regex engine <-> engine syntax & character class names. It gets worse when utils also conditionally enable extended syntaxes with flags or options.

    The hardest part is remembering whether you need to use \w or [:alnum:].

    Way too few utils actually mention which syntax they use too. Most just say something accepts a "regular expression", which is totally ambiguous.

  • source
  • parent
  • [–] 1 point 2 years ago

    This is exactly it. Regex is super simple. The difficulty is maintaining a mental mapping between language/util <-> regex engine <-> engine syntax & character class names. It gets worse when utils also conditionally enable extended syntaxes with flags or options.

    The hardest part is remembering whether you need to use \w or [:alnum:].

    Way too few utils actually mention which syntax they use too. Most just say something accepts a "regular expression", which is totally ambiguous.

  • source
  • parent
  • [–] 1 point 2 years ago

    This is exactly it. Regex is super simple. The difficulty is maintaining a mental mapping between language/util <-> regex engine <-> engine syntax & character class names. It gets worse when utils also conditionally enable extended syntaxes with flags or options.

    The hardest part is remembering whether you need to use \w or [:alnum:].

    Way too few utils actually mention which syntax they use too. Most just say something accepts a "regular expression", which is totally ambiguous.

  • source
  • parent