sorry if the title is not clear, I'm open to change it if you suggest a better one, the problem is it:
I've a string like this
val text1 = "123 456 blah 345qq"
and this code
val rx1 = """(\d+)\s+\d+""" .r
def something(a : String) = s"<:$a:>"
rx1.replaceAllIn(text1,(m)=> something(???))
I just wanna replace the capturing match between parenthesis, that means, the result must be
<:123:> 456 blah 345qq
using
rx1.replaceAllIn(text1,(m)=> something(m)
capture the whole match: not only the first digits also the space(s) and next digit(s) resulting in something like this <:123 456:> blah 345qq so I know than I must use the group method in the regex.Match
rx1.replaceAllIn(text1,(m)=> something(m.group(1)))
this is a bit better but the result is <:123:> blah 345qq , notice than the digits 456 are removed
<:123:> blah 345qq wrong!
<:123:> 456 blah 345qq right
how can archieve this goal in a nice and scala idiomatic way?..thanks!!!.