The Enchanted Tavern
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
@cm0002@lemmy.world to Programmer Humor@programming.dev • 3 months ago

what debugging regex feels like

lemmy.ml

message-square
86
fedilink
  • cross-posted to:
  • programmerhumor@lemmy.ml
903

what debugging regex feels like

lemmy.ml

@cm0002@lemmy.world to Programmer Humor@programming.dev • 3 months ago
message-square
86
fedilink
  • cross-posted to:
  • programmerhumor@lemmy.ml
alert-triangle
You must log in or register to comment.
  • @lmmarsano@lemmynsfw.com
    link
    fedilink
    English
    2•
    edit-2
    3 months ago

    Elisp has a nice notation for maintainably composing regexes like any other programming expression. Only language I’ve seen offer that. So instead of "/\\*\\(?:[^*]\\|\\*[^/]\\)*\\*+/", the regular expression to match C block comments could be expressed (with inline comments)

    (rx "/*"                          ; Initial /*
        (zero-or-more
         (or (not (any "*"))          ;  Either non-*,
             (seq "*"                 ;  or * followed by
                  (not (any "/")))))  ;  non-/
        (one-or-more "*")             ; At least one star,
        "/")                          ; and the final /
    

Programmer Humor@programming.dev

!programmer_humor@programming.dev
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: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
  • 43 users / day
  • 433 users / week
  • 1.23K users / month
  • 3.81K users / 6 months
  • 1 subscriber
  • 1.37K Posts
  • 45.5K Comments
  • Modlog
  • mods:
  • Feyter
  • adr1an
  • @BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne
  • UI: unknown version
  • BE: 0.18.2
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org