This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-28
Channels
- # announcements (4)
- # aws (2)
- # babashka (56)
- # beginners (43)
- # calva (71)
- # clj-kondo (25)
- # cljs-dev (29)
- # clojure (103)
- # clojure-dev (9)
- # clojure-europe (55)
- # clojure-gamedev (8)
- # clojure-nl (5)
- # clojure-norway (5)
- # clojure-uk (4)
- # clojured (1)
- # clojurescript (56)
- # copenhagen-clojurians (1)
- # core-async (2)
- # cursive (16)
- # datomic (5)
- # deps-new (18)
- # emacs (9)
- # events (3)
- # fulcro (45)
- # graphql (2)
- # gratitude (2)
- # kaocha (6)
- # lambdaisland (8)
- # lsp (72)
- # meander (41)
- # missionary (5)
- # nextjournal (52)
- # off-topic (2)
- # pathom (12)
- # pedestal (2)
- # practicalli (1)
- # re-frame (6)
- # reitit (5)
- # releases (1)
- # reveal (1)
- # specter (3)
- # sql (4)
- # tools-deps (22)
- # vim (8)
- # wasm (1)
- # xtdb (22)
I'm trying to replicate this in regal (https://github.com/lambdaisland/regal) using a backrefernce to match any 3 or more of the same consecutive character:
(re-find #"(.)\1{3,}" "111123")
;;=> ["1111" "1"]
But can't seem to get it:
(regal/regex
[:cat [:capture :any] [:repeat ::_ 3 nil]]
{:resolver (fn [x] "\\1")})
;;=> #"(.)(?:\\1){3,}"
(regal/regex
[:capture [:capture :any] [:repeat ::_ 3 nil]]
{:resolver (fn [x] "\1")})
;;=> #"((.){3,})"
(regal/regex
[:capture [:capture :any] [:repeat ::_ 3 nil]]
{:resolver (fn [x] "\\\\1")})
;;=> #"((.)(?:\\\\1){3,})"
Any tips?(ns repl-sessions.poke
(:require [lambdaisland.regal :as regal]
[lambdaisland.regal.parse :as regal-parse]))
(regal-parse/parse #"(.)\1{3,}")
;; => [:cat
;; [:capture :any]
;; [:repeat [:lambdaisland.regal.parse/not-implemented [:BackReference "1"]] 3]]
backreferences aren't implemented, but seems like a common enough feature that they should be. Would you mind creating a ticket?A google search seems to suggest that Re2 does not https://github.com/google/re2/issues/101
ok, that's not the end of the world. For Re2 we don't strive for 100% compatibility, since they deliberately don't handle certain features