Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 防止在Angular 4中使用unicode字符_Html_Angular_Typescript - Fatal编程技术网

Html 防止在Angular 4中使用unicode字符

Html 防止在Angular 4中使用unicode字符,html,angular,typescript,Html,Angular,Typescript,我有一个前端开发使用角4框架。是否有任何方法可以验证文本字段,从而防止用户使用任何unicode字符。例如: ½->U+00BD('onehalf')您可以在输入上放置正则表达式: <input type="text" name="name" pattern="[\x20-\x7E]" title="name"> 只需运行regex即可[\x20-\x7E]谢谢您的输入!似乎它不接受任何字符。如果我输入一个常规字符串-ABC,它会显示“请匹配请求的格式”。“½”的同一消息无法复制

我有一个前端开发使用角4框架。是否有任何方法可以验证文本字段,从而防止用户使用任何unicode字符。例如:


½->U+00BD('onehalf')

您可以在输入上放置正则表达式:

<input type="text" name="name" pattern="[\x20-\x7E]" title="name">


只需运行regex即可
[\x20-\x7E]
谢谢您的输入!似乎它不接受任何字符。如果我输入一个常规字符串-ABC,它会显示“请匹配请求的格式”。“½”的同一消息无法复制:/Or让我这样问。标签中的正则表达式应该是什么,以便只允许使用字母数字字符。例如:“ABC CDE”->(有效)“ABCD½”->(无效)@Archit如果对您有效,请将我的答案标记为接受答案:)谢谢您的输入!似乎它不接受任何字符。如果我输入一个常规字符串-ABC,它会显示“请匹配请求的格式”。“½”@Archit的相同消息似乎对我有效。你能发布你的代码吗?