1

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
  • What is your expected result?
    – Toto
    Commented Aug 19, 2020 at 17:21

1 Answer 1

5

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
  • @x a: Please don't make wrong modifications. I suggest you to learn basic regex before!
    – Toto
    Commented Oct 3, 2020 at 17:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .