I have large txt files which i want to import to database. I need only one : on every line.If there is more :: these characters on line i want to delete that line. Any suggestions how to do it ?. I would like to use editors as notepad++ or something similar.
it looks like this for example
fizol23@seznam.cz::1234::
yaehl005lhey@seznam.cz:dimayacyac
robjtim@seznam.cz:thatcher1
fchrismo49@seznam.cz:494949
melanie3850@seznam.cz:jacobbb:
trishmercado@seznam.cz:brooklyn
You can use lookarounds to do this.
^.*(?=:.*:).*$
This effectively says match everything from the start of the line ^.*
to the end of the line .*$
where there are at least 2 colons on that line.
If you only want to match lines with specifically ::
(no characters between them) then you can specify that in the lookaround ( ^.*(?=::).*$
).
You can read more about lookarounds here: https://www.regular-expressions.info/lookaround.html.