I want to remove "ing" from word, example i want "watching" become "watch" by removing "ing" from the end of the word. Using regex in java.
i use this pattern:
String pattern = "$ing";
and use it to remove:
String word = "watching";
word = word.replaceAll(pattern,"");
but the result is still "watching" not "watch"
Put the dollar sign at the last, so that it matches the last ing
. $
is an anchor which represents End of the line.
Example:
System.out.println("watching".replaceAll("ing$", ""));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With