How to remove all special symbols after : in EmEditor

119 views Asked by At

Hello i need delete all special symbols like .,_- after symbol :

Example i got something like that

sfjsfajsafwp.pl:fsasaf.fssf
sfjsfajsafwp.pl:fsasaf.fssf
sfjsfajsafwp.pl:fsasaf.fssf.dgdg_

After this i expect:

sfjsfajsafwp.pl:fsasaffssf
sfjsfajsafwp.pl:fsasaffssf
sfjsfajsafwp.pl:fsasaffssfdgdg
1

There are 1 answers

0
Toto On BEST ANSWER
  • Ctrl+H
  • Find what: (?:^.*?:|\G(?!^)).*?\K[-.,_]+
  • Replace with: LEAVE EMPTY
  • TICK Wrap around
  • SELECT Regular expression
  • UNTICK . matches newline
  • Replace all

Explanation:

(?:         # non capture group
    ^           # beginning of line
    .*?         # 0 or more any character but newline
    :           # colon
  |           # OR
    \G          # restart from last match position
    (?!^)       # negative lookahead, make sure we are not at the beginning of a line
)           # end group
.*?         # 0 or more any character but newline
\K          # forget all we have seen until this position
[-.,_]+     # 1 or more any of these characters. 
            # You can add all the characters you want to delete
            # If you want to keep only letters, use [^a-zA-Z\r\n]+

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here