How to manipulate regex replacement strings in Elixir
问题 I found myself wanting to do this in Elixir: re_sentence_frag = %r/(\w([^\.]|\.(?!\s|$))*)(?=\.(\s|$))/ Regex.replace(re_sentence_frag, " oh. a DOG. woOf. ", String.capitalize("\\1")) Of course, that has no effect. (It capitalizes the string "\\1" just once.) What I really meant is to apply String.capitalize/1 to every match found by the replace function. But the 3rd parameter can't take a function reference, so passing &(String.capitalize("\\1") also doesn't work. This seems so fundamental