Fork me on GitHub
#off-topic
<
2018-07-31
>
borkdude10:07:25

(let [matcher (re-matcher #"(foo)*(?<name>.+)(foo)*" "foofoohellofoofoo")]
    (when (.matches matcher)
      {:name (.group matcher "name")}))
Now I get
{:name "hellofoofoo"}
How do I improve the regex to only get hello?

borkdude10:07:43

The name group is a bit too eager

borkdude10:07:39

foo is more complex in my real code

dominicm10:07:52

@borkdude non-greedy matching is the term you want, I think it's often .+?

dominicm10:07:30

@borkdude .+? works for me

borkdude10:07:08

thanks 🙂

borkdude10:07:27

I had the question mark on the wrong side of the paren

jjttjj16:07:10

anyone know if there's a way to generate some sort of parseable api schema (json/xml/anything?) from a java class and/or source file? I'm fiddling with a combination of parsing and reflection now but wondering if there's some library that does this

jjttjj16:07:54

i basically just need method names, their argument names and types, and the return types

jgh16:07:39

WSDL 😄

jjttjj17:07:15

hmmm that seems like it would work but is there an actual library i can use to generate it rather than a standalone program

jgh17:07:28

i think there must be, but honestly i havent used it in 10+ years. i guess there are probably things for rest services also

orestis20:07:45

I just learned about the existence of alternative JVMs, specifically OpenJ9 which is supposedly aimed for web applications etc. Is anyone using JVMs that are not Oracle or OpenJDK?

vrcca20:07:28

There's also Azul JVM

mauricio.szabo20:07:49

@orestis I'm using OpenJ9 for development

mauricio.szabo20:07:12

The memory footprint is waaay smaller (for the first time, my Java VM is in the 4th position in memory consumption)

orestis20:07:16

Azul doesn’t have a free offering, does it?

jsa-aerial20:07:17

^^^ I don't believe so - at least for any 'real' use ^^^

hiredman20:07:36

@mauricio.szabo did you change any of the heap settings on other jvms you've tried? openj9 may just have a smaller default heap size

mauricio.szabo21:07:18

Not really, but what I found out is that on other VMs I worked with, if I made any change to the heap size most apps will just not work. With J9, this didn't happen

orestis21:07:46

They advertise smaller memory footprint and “pauseless” GC as their main differentiators, so I don’t think it’s only a smaller heap size.