I'm trying to match an end of a word/string with the following expression: "m[abcd]" and replace this ending with another one looking like this "?q", where the question mark matches one of the characters a,b,c or d. The problem is, i have a lot of diffrent endings. This is an example:
Ending: m[abcd]
Replacment: ?q
Words: dfma, ghmc, tdfmd
Desired result: dfaq, ghcq, tdfdq
How to do it using the replaceAll method for Strings in Java or any other Java method? Maybe i can make it with lots of code, but i'm asking for a shorter solution. I don't know how to connect to separete regular expressions.