Loading ...
Sorry, an error occurred while loading the content.
 

Regular Expression Help

Expand Messages
  • T Cosmas
    Can someone suggest a regular expression which would allow me to make the following change? Input text: tom.cosmas@my.company.com Output text: tom . cosmas AT
    Message 1 of 5 , Aug 1, 2007
      Can someone suggest a regular expression which would allow me to make
      the following change?

      Input text:
      tom.cosmas@...

      Output text:
      tom . cosmas AT my . company . com

      I know I can do two S/Rs; but it seems this should be doable as a
      RegExp S/R.

      Thanks.
    • Aleem Juma
      My first instinct would be: Find ([^ .]*) .([^@]*)@([^ .]*) .([^ .]*) .(.*)$ Replace with 1 . 2 AT 3 . 4 . 5
      Message 2 of 5 , Aug 1, 2007
        My first instinct would be:

        Find
        ([^\.]*)\.([^@]*)@([^\.]*)\.([^\.]*)\.(.*)$

        Replace with
        \1 . \2 AT \3 . \4 . \5


        On 01/08/07, T Cosmas <t_cosmas@...> wrote:
        > Can someone suggest a regular expression which would allow me to make
        > the following change?
        >
        > Input text:
        > tom.cosmas@...
        >
        > Output text:
        > tom . cosmas AT my . company . com
        >
        > I know I can do two S/Rs; but it seems this should be doable as a
        > RegExp S/R.
        >
        > Thanks.
        >
        >
        >
        > http://www.editplus.com
        > Yahoo! Groups Links
        >
        >
        >
        >
      • dz@caribe.net
        If the pattern of the e-mail address will always be the same, you can try this: Find: ^([^.]+) .([^ @]+) @([^.]+) .([^.]+) .([^.]+)$ Replace: 1 . 2 AT 3
        Message 3 of 5 , Aug 1, 2007
          If the pattern of the e-mail address will always be
          the same, you can try this:

          Find: ^([^.]+)\.([^\@]+)\@([^.]+)\.([^.]+)\.([^.]+)$
          Replace: \1 . \2 AT \3 . \4 . \5

          The problem is that with EditPlus Search/Replace you
          cannot match indefinite groups and have access to
          them (like matching any number of groups followed by
          periods, instead of a fixed amount).

          But if you're going to replace the same e-mail
          address on all files, you may as well use a direct
          string replacement.

          -dZ.

          >------- Original Message -------
          >From : T Cosmas[mailto:t_cosmas@...]
          >Sent : 8/1/2007 9:22:21 AM
          >To : editplus@yahoogroups.com
          >Cc :
          >Subject : RE: [edit+] Regular Expression Help
          >
          >Can someone suggest a regular expression which
          would allow me to make
          the following change?

          Input text:
          tom.cosmas@...

          Output text:
          tom . cosmas AT my . company . com

          I know I can do two S/Rs; but it seems this should be
          doable as a
          RegExp S/R.

          Thanks.



          http://www.editplus.com
          Yahoo! Groups Links
        • Mark Kahn
          no, it s not possible if you re trying to do this on general e-mail addresses simply because you could potentially have a dozen periods in your e-mail:
          Message 4 of 5 , Aug 1, 2007
            no, it's not possible if you're trying to do this on general e-mail
            addresses simply because you could potentially have a dozen periods in your
            e-mail:

            my.long.email.address@...

            Aleem's solution would work for a.b@c.d.e, but not a.b@c.d, etc.

            Just replace . with ' . ' and @ with ' AT '. it's not much more difficult.
            If you're doing it in EP you can write a macro to do it. It it's in code
            you might be able to chain regex's together:

            fixed = email.replace(/\./g, ' . ').replace(/@/g, ' AT ');

            -Mark

            On 8/1/07, T Cosmas <t_cosmas@...> wrote:
            >
            > Can someone suggest a regular expression which would allow me to make
            > the following change?
            >
            > Input text:
            > tom.cosmas@... <tom.cosmas%40my.company.com>
            >
            > Output text:
            > tom . cosmas AT my . company . com
            >
            > I know I can do two S/Rs; but it seems this should be doable as a
            > RegExp S/R.
            >
            > Thanks.
            >
            >
            >


            [Non-text portions of this message have been removed]
          • Mark Kahn
            oh, and also note that if you re doing this for the same of preventing e-mail harvesting, it s hardly even worth the effort as it s just as simply to harvest
            Message 5 of 5 , Aug 1, 2007
              oh, and also note that if you're doing this for the same of preventing
              e-mail harvesting, it's hardly even worth the effort as it's just as simply
              to harvest e-mail addresses that are formed like this.

              -Mark

              On 8/1/07, Mark Kahn <cwolves@...> wrote:
              >
              > no, it's not possible if you're trying to do this on general e-mail
              > addresses simply because you could potentially have a dozen periods in your
              > e-mail:
              >
              > my.long.email.address@...
              >
              > Aleem's solution would work for a.b@c.d.e, but not a.b@c.d, etc.
              >
              > Just replace . with ' . ' and @ with ' AT '. it's not much more
              > difficult. If you're doing it in EP you can write a macro to do it. It
              > it's in code you might be able to chain regex's together:
              >
              > fixed = email.replace(/\./g, ' . ').replace(/@/g, ' AT ');
              >
              > -Mark
              >
              > On 8/1/07, T Cosmas < t_cosmas@...> wrote:
              > >
              > > Can someone suggest a regular expression which would allow me to make
              > > the following change?
              > >
              > > Input text:
              > > tom.cosmas@... <tom.cosmas%40my.company.com>
              > >
              > > Output text:
              > > tom . cosmas AT my . company . com
              > >
              > > I know I can do two S/Rs; but it seems this should be doable as a
              > > RegExp S/R.
              > >
              > > Thanks.
              > >
              > >
              > >
              >
              >


              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.