Hence, the letter ‘a’ in the first text gets matched. In this example, all strings with zero or more occurrences of ‘a’, followed by zero or more occurrences of ‘b’ are matched. As a result, the letter ‘a’ in the first text does not get matched since it is not followed by the letter ‘b’. In the example shown above, we are looking for the character ‘a’ in the string and rightly so, they are highlighted.Īlthough the quantifier ‘*’ indicates zero or more occurrences of the character ‘a’, it is followed by the character ‘b’. ? - Indicates zero or one occurrence of the character n * - Indicates zero or more occurrences of the character n + - Indicates one or more occurrence of the character n The most commonly used quantifiers are ‘+’, ‘*’ and ‘?’. Quantifiers define the number of occurrences of a string. However, all the digits, whitespaces, and uppercase letters are matched in the text. In the example above, all the lowercase letters are ignored. All the lowercase letters in the alphabet and digits are matched.Ī ‘^’ (caret) symbol indicates that the characters following it should not be matched with the text. This is because the flag “i” is not used. If you closely observe, the upper case letters are not matched. In this example, all the digits are matched.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |