Jump to content

Python ReGex

- - - - -

  • Please log in to reply
3 replies to this topic

#1
bishisht

bishisht

    Newbie

  • Members
  • PipPip
  • 23 posts
hello there all. I am new to python. i have a long contact list file that my friends extracted from internet. what i want to do is, i want to extract all the email addresses from the file and i have successfully done that. but now i also want to add a ";" at the end of each email addresses please tell me how can i do that.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
You would do a regex search/replace where you put parenthesis around your regex for an email and replace it with $1;
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
bishisht

bishisht

    Newbie

  • Members
  • PipPip
  • 23 posts
Can u please post the code. I am a newbie. Thanks. :D

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Unfortunately, I know Regex better than python (by a lot), and there are subtle differences between environments. You already have the code to validate emails, so adding the parenthesis shouldn't be hard.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users