Discussion
Loading...

Discussion

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Jamey Sharp
Jamey Sharp
@jamey@toot.cat  ·  activity timestamp 4 months ago

@EveHasWords Nice use of regular expressions and nice explainer!

The A-z range is a little bit unfortunate since, in addition to the upper and lower case letters, it also includes all of [\]^_ plus backtick. I would suggest writing out A-Za-z explicitly, though for this use case it probably doesn't hurt anything.

Which variant of regular expression syntax allows backslash-escaping dashes in character classes? I'm used to them requiring that dash be the last thing listed in the character class if you want to include it literally, so [ax-] if you want to match a, x, or -. A quick test with grep shows that [a\-b] matches anything between \ and b, including ]^_. But every regex implementation is a little bit different so I can certainly believe backslash escapes work in some of them.

  • Copy link
  • Flag this post
  • Block
Eve Ventually
Eve Ventually
@EveHasWords@toot.cat replied  ·  activity timestamp 4 months ago

@jamey The A-z range would probably an upside for me in my writing since I use Markdown for my drafts but I definitely take your point there.

For escaping in character classes, all of the ones I use today allow for it. I tend to use dash at the end anyway out of habit but KWrite (presumably also Kate), Markedit, Ghostwriter, and Notepad++ allow me to escape without turning it into a range.

  • Copy link
  • Flag this comment
  • Block
Federation Bot
Federation Bot
@Federation_Bot replied  ·  activity timestamp 4 months ago

@EveHasWords Neat, I just verified that Kate supports backslash-escaping dash in character classes. I have learned something today. Thanks!

  • Copy link
  • Flag this comment
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.2-alpha.7 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct