Futurology Today
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
VegOwOtenks@lemmy.world to Programmer Humor@lemmy.mlEnglish · 1 year ago

Regex flavors

lemmy.world

message-square
20
link
fedilink
100

Regex flavors

lemmy.world

VegOwOtenks@lemmy.world to Programmer Humor@lemmy.mlEnglish · 1 year ago
message-square
20
link
fedilink
  • ☆ Yσɠƚԋσʂ ☆@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    I really like this approach for doing non trivial regex https://github.com/VerbalExpressions

    const tester = VerEx()
        .startOfLine()
        .then('http')
        .maybe('s')
        .then('://')
        .maybe('www.')
        .anythingBut(' ')
        .endOfLine();
    
    • frezik@midwest.social
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 year ago

      I don’t. It may look less like line noise, but it doesn’t unravel the underlying complexity of what it does. It’s just wordier without being helpful.

      https://www.wumpus-cave.net/post/2022/06/2022-06-06-how-to-write-regexes-that-are-almost-readable/index.html

      Edit: also, these alternative syntaxes tend to make some easy cases easy, but they have no idea what to do with more complicated cases. Try making nested capture groups with these, for instance. It gets messy fast.

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 132 users / day
  • 1.07K users / week
  • 3.21K users / month
  • 9.98K users / 6 months
  • 9 local subscribers
  • 36.9K subscribers
  • 1.56K Posts
  • 23.3K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.11
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org