This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-23
Channels
- # announcements (5)
- # aws (4)
- # babashka (141)
- # beginners (139)
- # calva (35)
- # cider (5)
- # clj-kondo (27)
- # cljsrn (20)
- # clojure (37)
- # clojure-czech (5)
- # clojure-dev (26)
- # clojure-europe (11)
- # clojure-germany (1)
- # clojure-italy (1)
- # clojure-nl (3)
- # clojure-spec (17)
- # clojure-uk (16)
- # clojurescript (2)
- # conjure (1)
- # cursive (6)
- # datomic (20)
- # defnpodcast (1)
- # emacs (15)
- # fulcro (26)
- # honeysql (2)
- # instaparse (3)
- # jackdaw (4)
- # jobs (2)
- # lsp (70)
- # luminus (2)
- # meander (16)
- # missionary (2)
- # other-languages (151)
- # pathom (6)
- # portkey (13)
- # re-frame (13)
- # reagent (2)
- # reitit (43)
- # releases (1)
- # remote-jobs (1)
- # reveal (5)
- # rum (2)
- # sci (15)
- # shadow-cljs (37)
- # spacemacs (4)
- # tools-deps (8)
- # vim (20)
hello, I’m trying to understand how to use m/re
to match something, but I always get nil, example:
(m/find "csa sa R$ 231,52 casa"
(m/re #"\d{3},\d{2}" ?0)
?0)
is this intended to be used to match like this?On my phone. But from the doc string re uses re-matches. Which matches the whole string. So my guess is you need a pattern that matches the entire string, not just part of it.
humm, is there a way to use with re-find
? in my case I have these long strings, and just wanna match a small portion of it, and extract it in the process
I’m getting around using (m/pred #(re-find ...))
, but that forces me to run the regex twice (to extract the content later), and look ugly, the syntax on m/re
is just perfect, but having problems to match the small string in a long text
Would changing you regex to this and grabbing group 1 not work? .**(\d{3},\d{2}).**
Or are you looking for multiple matches?
If so, I can look at this later when not on my phone.
no, a single match, I got it work with #"(?s).*(\d+,\d{2}).*"
🙂
humm, kind of
it matches, but now it matches the last occurence, while I need the first
I guess having one to match all would be nice
Just change the first to non-greedy star .*?
sorry, was my bad, its matching the right thing 🙂
and yes, non-greedy should solve if that was the case
all working nice now, thanks @U5K8NTHEZ!
No problem :). Glad it is working.