Remove an apostrophe at the beginning or at the end of a word with regex
问题 I have a list of String that contains word. Some words have apostrophe at the beginning or/and at the end like this: apple 'orange banana' joe's I want to delete only the apostrophes at the beginning and at the end of the words like this: apple orange banana joe's I have tried with the following regex but it doesn't work: myString.replaceAll("((?<=^)'|'(?=$))", ""); It does not work in IntelliJ: But it works with regex101.com: Why the regex dosen't works and how can I remove the beginning and