gpt4 book ai didi

asp.net-mvc - 在属性值中转义 @

转载 作者:行者123 更新时间:2023-12-05 04:13:27 25 4
gpt4 key购买 nike

我想为我的电子邮件输入字段添加一个模式:

<input type="email" size="1" required="" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,63}$">

用@@转义不起作用

<input type="email" size="1" required="" pattern="[a-z0-9._%+-]+@@[a-z0-9.-]+\.[a-z]{2,63}$">

这总是给我以下异常:

"[" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid.

请注意输入在@if { } block 中。

知道我能做什么吗?

最佳答案

括号来拯救!任何时候 Razor 中出现歧义时,您都可以使用括号明确你想要什么:

<input type="email" size="1" required="" pattern="[a-z0-9._%+-]+@("@")[a-z0-9.-]+\.[a-z]{2,63}$">

关于asp.net-mvc - 在属性值中转义 @,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37617055/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com