Sure, here is a regularexpression to match a line that doesn't contain a word:
^[^\w\s]+$
The ^ metacharacter matches the beginning of the line, and the
$ metacharacter matches the end of the line. The \w metacharacter matches any word character, which includes letters, numbers, and the underscore character. The
\s metacharacter 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:
--
12345
.
The following lines would not be matched by this regex pattern:
hello
world
this is a sentence
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Sure, 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: