M BUZZ CRAZE NEWS
// news

Regex: Select all the words/strings that begins with .dot

By Gabriel Cooper

I want to select with regex all the words that begins with .dot

for example: .myself or .I go home or .5 a clock

Can you help me?

1

1 Answer

The main problem with dots is that . is the regex character for 'matches anything'. You need to escape it with a backslash.

The following regex would match words that begin with a dot:

\.\w+

It means that in your example .I go home only .I will be matched, since the word go does not start with a dot. If you would like to change that and extend that to the entire line, so for instance only match the second line in the following text

I go home
.I go home
I go home

you'd need the following regex:

^\..*

where .* means 'match everything'. (In that case, make sure the Notepad++ option ". matches new line" is disabled, or you'll select the rest of the entire text.)

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy