-2

I have a list of subdomains and I want to remove any dot at the beginning of a line, if there is no dot at the beginning of the line, then it leaves that line untouched.

Like this example:

x8.ext.indeed.com
yk1.ext.indeed.com
za.indeed.com
zera.ext.indeed.com
.envoy.eastus2.qa.notjet.net
.envoy.westus.qa.notjet.net
.nomad.eastus2.qa.notjet.net
.nomad.westus.qa.notjet.net
.notjet.net
.torbit.notjet.net
artifacts.notjet.net
bamf.notjet.net
bamfdb.notjet.net
Soufiane
  • 1
  • 4

1 Answers1

0

For cases like this use the line-start reference ^ and the specific dot [.]match with your regexp constraining that to a minimum match +, so altogether your regex will be: ^[.]+

I recommend regex101.com to experiment and try queries out too if you want to see in a highlighted way how this works: https://regex101.com/r/hW63Ab/1/

muratiakos
  • 909
  • 8
  • 18