Regular expression to match a line that doesn't contain a word.
Regular expression to match a line that doesn't contain a word.
334
29-Aug-2023
Updated on 04-Sep-2023
Aryan Kumar
04-Sep-2023Sure, here is a regular expression to match a line that doesn't contain a word:
The
^metacharacter matches the beginning of the line, and the$metacharacter matches the end of the line. The\wmetacharacter matches any word character, which includes letters, numbers, and the underscore character. The\smetacharacter matches any whitespace character.So, this regex pattern will match any line that does not contain any word characters or whitespace characters.
For example, the following lines would be matched by this regex pattern:
The following lines would not be matched by this regex pattern: