12/24/2023 0 Comments Regex cheat sheetNegative lookahead assertion: Matches “x” only if “x” is not followed by “y”. For example, /\d+(?!\.)/ matches a number only if it is not followed by a decimal point. However, neither “Sprat” nor “Frost” is part of the match results. Jack(?=Sprat|Frost)/ matches “Jack” only if it is followed by “Sprat” or “Frost”. “Jack” only if it is followed by “Sprat”. Lookahead assertion: Matches “x” only if “x” is followed by “y”. ![]() Same as the matched word boundary, the matched non-word boundary is also not included in the match.įor example, /\Bon/ matches “on” in “at noon”, and /ye\B/ matches “ye” in “possibly yesterday”. This is a position where the previous and next character are of the same type: Either both must be words, or both must be non-words, for example between two letters or between two spaces. The beginning and end of a string are considered non-words. To match a backspace character ( ), see Character Classes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |