![]() ![]() Hello the problem is not the expression but the HTML out put that are not considered as whitespace. Thus, it does more than just 'check if there is at least one non-whitespace character'. Your regex matches a string that consists entirely of non-whitespace characters and is at least one character in length. The method matches () takes two arguments: the first is the regular expression, and the second is the string we want to match. Assuming that the spaces after the first and. Are you capturing the whitespace to a group for a reason? If not you could just remove the brackets, i.e. The regex is good, but the explanation is a bit misleading. The problem with this regex is that the capture group is greedy and will match anything including whitespace. '(\w\s) ' : this must match a word with a white space at least and must finish with white space.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |