Java String

Java String replaceAll() and replaceFirst() Methods

Java String replaceAll() method is used to replace each substring that matches the specified regular expression with the specified replacement string. The replaceAll() and replaceFirst() methods internally uses Matcher class. Both of these methods accepts two arguments – regex string and replacement string. If the regex is invalid, PatternSyntaxException is thrown. The methods were introduced in …

Java String replaceAll() and replaceFirst() Methods Read More »