Change Email

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shapper

    Change Email

    Hello,

    I have a string that contains one or more email anchors as follows:

    1. "this is a text <a title="Send Email"
    href="mailto:ma il@mydomain.com ">mail@mydomain </a>"

    Or something like (In this case the anchor text is not the email
    address):

    2. "this is a text <a title="Send Email"
    href="mailto:ma il@mydomain.com ">Send Email</a>"

    I need to do the following:
    Replace all @ by // and . by / ... In the email address
    If the anchor text is an email address replace it by Email and add
    to the anchor the Css Class "LowReplace "
    If the anchor text is not an email address then add to the anchor
    the Css Class "Low"

    Could someone help me doing this?

    Thank You,
    Miguel
  • =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?=

    #2
    RE: Change Email

    Regular Expressions are probably the way forward for this as you can do them
    in C# on the server and in javascript on the client (although they differ
    slightly). I am not a regular expressions wizard but there are plenty of
    articles on them on the web. As for adding the css class, this is done
    differently on the client to the server so you would need to provide more
    information about where and when you are looking to do this.

    HTH

    --
    Ciaran O''Donnell
    try{ Life(); } catch (TooDifficultException) { throw Toys(); }



    "shapper" wrote:
    Hello,
    >
    I have a string that contains one or more email anchors as follows:
    >
    1. "this is a text <a title="Send Email"
    href="mailto:ma il@mydomain.com ">mail@mydomain </a>"
    >
    Or something like (In this case the anchor text is not the email
    address):
    >
    2. "this is a text <a title="Send Email"
    href="mailto:ma il@mydomain.com ">Send Email</a>"
    >
    I need to do the following:
    >
    Replace all @ by // and . by / ... In the email address
    >
    If the anchor text is an email address replace it by Email and add
    to the anchor the Css Class "LowReplace "
    >
    If the anchor text is not an email address then add to the anchor
    the Css Class "Low"
    >
    Could someone help me doing this?
    >
    Thank You,
    Miguel
    >

    Comment

    • shapper

      #3
      Re: Change Email

      On Sep 18, 10:42 am, Ciaran O''Donnell
      <CiaranODonn... @discussions.mi crosoft.comwrot e:
      Regular Expressions are probably the way forward for this as you can do them
      in C# on the server and in javascript on the client (although they differ
      slightly). I am not a regular expressions wizard but there are plenty of
      articles on them on the web. As for adding the css class, this is done
      differently on the client to the server so you would need to provide more
      information about where and when you are looking to do this.
      >
      HTH
      >
      --
      Ciaran O''Donnellhttp://wannabedevelope r.spaces.live.c om
      >
      "shapper" wrote:
      Hello,
      >
      I have a string that contains one or more email anchors as follows:
      >
      1. "this is a text <a title="Send Email"
      href="mailto:m. ..@mydomain.com ">mail@mydomain </a>"
      >
      Or something like (In this case the anchor text is not the email
      address):
      >
      2. "this is a text <a title="Send Email"
      href="mailto:m. ..@mydomain.com ">Send Email</a>"
      >
      I need to do the following:
      >
        Replace all @ by // and . by / ... In the email address
      >
        If the anchor text is an email address replace it by Email and add
      to the anchor the Css Class "LowReplace "
      >
        If the anchor text is not an email address then add to the anchor
      the Css Class "Low"
      >
      Could someone help me doing this?
      >
      Thank You,
      Miguel
      I have this covered on the client ... it is working. The problem now
      is on the server in C#

      Comment

      Working...