Tagged: regex Toggle Comment Threads | Keyboard Shortcuts

  • harlekwinblog 3:03 pm on February 21, 2011 Permalink | Reply
    Tags: regex,   

    In Vim you can find valid e-mail addresses with the command:
    /^[a-z0-9][a-z0-9_\.-]*@[a-z0-9][a-z0-9-]*\(\.[a-z0-9][a-z0-9-]*\)*$
    Requires that the e-mail address is on a line on it’s own.
    Alternatively:
    /[a-z0-9][a-z0-9_\.-]*@[a-z0-9][a-z0-9-]*\(\.[a-z0-9][a-z0-9-]*\)*
    Will find such addresses anywhere on a line.

    Advertisement
     
  • harlekwinblog 2:58 pm on February 21, 2011 Permalink | Reply
    Tags: regex,   

    In Vim you can delete empty lines with the command:
    :g/^$/d

     
  • harlekwinblog 2:56 pm on February 21, 2011 Permalink | Reply
    Tags: regex,   

    In Vim you can remove duplicate lines with the command:
    :%s/^\(.*\)\n\1$/\1/

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel