Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • james 37 posts 121 karma points c-trib
    Aug 01, 2013 @ 12:14
    james
    0

    Ampersands in regular expressions

    Hello,

    I have an email address on my form which is validated against the following regular expression:

    ^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$

    When the expression is output into the markup the ampersands are HTML encoded giving the following regex:

    ^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$

    Is there any way I can stop the ampersands from being HTML encoded?

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Aug 01, 2013 @ 12:31
    Tim Geyssens
    100

    Yeah update the views to use Html.Raw() will also fix this in the next maintenance release

    Details on customizing the views can be found here http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Developer/Custom-Markup/

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Aug 01, 2013 @ 12:32
    Tim Geyssens
    0
  • james 37 posts 121 karma points c-trib
    Aug 01, 2013 @ 13:03
    james
    0

    Thanks Tim, your workaround works for me :)

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Aug 01, 2013 @ 13:06
    Tim Geyssens
    0

    Cool thanks for confirming :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies