![]() ![]() ![]() String result = input. Replacing the pattern with single space Hello this is a sample text with irregular spaces Example 2 import Hello this is a sample text with irregular spaces It now has a new Extended search mode that allows you to search for tabs (t), newline (rn), and a character by its value (o, x, b, d, t, n, r and ). Since the release of version 4.9, the Notepad Find and Replace commands have been updated. Replacing all space characters with single space Notepad is an excellent text editor and replacement to Microsoft’s notepad.exe. ![]() Matcher matcher = pattern.matcher(input) Match the input string with the above regular expression and replace the results with single space “ ”. Therefore, to replace multiple spaces with a single space. The metacharacter “\s” matches spaces and indicates the occurrence of the spaces one or more times, therefore, the regular expression \S matches all the space characters (single or multiple). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |