Fork me on GitHub
#beginners
<
2019-01-02
>
andy.fingerhut00:01:25

re-matcher returns an instance of java.util.regex.Matcher, according to the doc string. The Java docs for that say that such a matcher is intended only for matching a regex against the entire input string, not only a part of it.

andy.fingerhut00:01:10

Or at least the matches method of it.

andy.fingerhut00:01:03

Did you want to look for possible matches of the regex in the middle of the string input, or only matches that match the entire string?

iagwanderson02:01:43

I need to verify in the middle of the string

iagwanderson02:01:14

I was only using the re-matcher because it allowed me to extract the regexp groups correctly

dante.the.monkey03:01:34

@hiredman @veix.q5 this is from Clojure For The Brave and True: It all comes down to efficiency. Because go blocks use a thread pool with a fixed size, you can create 1,000 go processes but use only a handful of threads:

(def hi-chan (chan))
(doseq [n (range 1000)]
  (go (>! hi-chan (str "hi " n))))
Worth a look: https://www.braveclojure.com/core-async/#Getting_Started_with_Processes

hiredman03:01:26

The handful of threads quote is somewhat misleading

hiredman03:01:50

You can create a ton of threads

hiredman03:01:59

The only limit I have ever hit (on the number if threads) is the os limit, which generally can be increased without any problem

hiredman03:01:13

And I have created a lot of threads

dante.the.monkey14:01:48

Fair enough. I just like the resource for being extremely beginner-friendly.

andy.fingerhut08:01:38

@iagwanderson re-find can also return the values of capture groups, if you parenthesize them in the regex expression.

andy.fingerhut08:01:18

user=> (re-find #"^([a-z])([A-Z][a-z])*([A-Z]?)$" "dAaBbC")
["dAaBbC" "d" "Bb" "C"]

iagwanderson09:01:21

thanks @andy.fingerhut didn't notice that

dawran622:01:04

Hi everyone, I've working on a toy project for a while and would love some code reviews / feedbacks on the clojurescript code that I wrote. Thanks. https://github.com/dawran6/markdown-editor