• BiscuityCat@lemmy.world
    link
    fedilink
    arrow-up
    11
    ·
    24 hours ago

    I never understood why are people scared of regular expressions. I love them and they can be quite usefull.

    Here is an example of one regex I wrote recently - it is used in replace:

    (?:^-\[[^[]+\]$| ?\[.+?\] ?)
    
    • lime!@feddit.nu
      link
      fedilink
      arrow-up
      1
      ·
      14 hours ago

      that feels overcomplicated. you’re always matching on square brackets anyway, so why make it a conditional? and one case not allowing spaces seems inconsistent…