Hi, I propose adding new key to option keyword list occurrence: n, where n is integer value of nth pattern occurrence in subject. https://hexdocs.pm/elixir/String.html#replace/4
Example: String.replace("a,b,c", ",", "-", occurrence: 2) "a,b-c" occurrence and global key should not be set together. In that case we should raise error. Why this new feature? Regex does only support greedy and not greedy replace, but replace nth occurrence is not supported by Regex. I needed this feature in advent of code 2015 day 19 task and it would also be useful in other cases of string parsing and manipulation. Thank you. -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/2d56bd3f-6514-44c7-a157-0bf6314dbea4n%40googlegroups.com.