【发布时间】:2026-02-20 16:05:01
【问题描述】:
我有这个 html(希伯来语文本):
בדיקה בדיקה בדיקה‎ניסיון ניסיון ניסיון
我想通过将 (‎) 替换为空格来删除它。
我尝试使用正则表达式:
$('#result').html($('#test').html().replace(/‎/, ' '));
$('#result2').html($('#test2').html().replace(/©/, ' '));
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="test">
בדיקה בדיקה בדיקה‎ניסיון ניסיון ניסיון
</div>
<hr />
<div id="test2">
בדיקה בדיקה בדיקה©ניסיון ניסיון ניסיון
</div>
<hr />
<div id="result"></div>
<hr />
<div id="result2"></div>
我添加了复制示例以表明我可以替换复制字符,因为它是可见符号。但是如何替换从左到右的符号呢?
【问题讨论】:
-
如何提问的好例子(这也是一个有趣的问题)
-
试试
$('#result').html($('#test').html().replace(/\u200E/, ' '));
标签: javascript html regex special-characters