meander

All things about https://github.com/noprompt/meander Need help and no one responded? Feel free to ping @U5K8NTHEZ
wilkerlucio 2021-04-23T04:12:46.174Z

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?

jimmy 2021-04-23T12:31:42.174200Z

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.

wilkerlucio 2021-04-23T13:09:55.174400Z

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

wilkerlucio 2021-04-23T13:10:36.174600Z

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

jimmy 2021-04-23T13:12:56.174900Z

Would changing you regex to this and grabbing group 1 not work? .**(\d{3},\d{2}).**

jimmy 2021-04-23T13:13:22.175100Z

Or are you looking for multiple matches?

jimmy 2021-04-23T13:13:42.175300Z

If so, I can look at this later when not on my phone.

wilkerlucio 2021-04-23T13:14:12.175500Z

no, a single match, I got it work with #"(?s).*(\d+,\d{2}).*" šŸ™‚

wilkerlucio 2021-04-23T13:15:19.175700Z

humm, kind of

wilkerlucio 2021-04-23T13:15:35.175900Z

it matches, but now it matches the last occurence, while I need the first

wilkerlucio 2021-04-23T13:15:41.176100Z

I guess having one to match all would be nice

jimmy 2021-04-23T13:16:29.176300Z

Just change the first to non-greedy star .*?

wilkerlucio 2021-04-23T13:17:28.176500Z

sorry, was my bad, its matching the right thing šŸ™‚

wilkerlucio 2021-04-23T13:17:35.176700Z

and yes, non-greedy should solve if that was the case

wilkerlucio 2021-04-23T13:29:43.176900Z

all working nice now, thanks @jimmy!

jimmy 2021-04-23T13:29:59.177100Z

No problem :). Glad it is working.