mardi 21 avril 2020

scala extract characters between characters in string and get first occurence only [duplicate]

I have such string:

val foo = "{foo} {bar} ... {sie}{ma}"

I want to extract characters from in between {} but I want to get first occurence only. I use findFirstIn but it returns all matches.

"""\{.*\}""".r.findFirstIn(foo)

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire