Thank you for your valuable responses and I found out that just using the pin operator can reverse the whole scenario. For example, if we have a test case
Assertion with == failed
code: assert WordCount.count("co-operative") == expected
left: %{"co" => 1, "operative" => 1}
right: %{"co-operative" => 1}
stacktrace:
test/word_count_test.exs:35: (test)```
here the word is co-operative and when I use the pin operator, it opts the "-" between the co-operative and which should be read as a single word. What is the better approach in this case?
Now the regex expression looks like
String.replace(b, ~r([^a-z 0-9]), " ")
Thanks


















