Use regular expressions to separate all punctuation marks in a string
The code copy is as follows:
<script language="javascript">
var str="jfkldsjalk,.23@#!$$k~! @#$%^&*()(_+-=|/{}[]';:,./<>??gg g~```gf";
str=str.replace(/[/ |/~|/`|/!|/@|/#|/$|/%|/^|/&|/*|/(|/)|/-|/_|/+|/=|/|//|/[|/]|/{|/}|/;|:|/"|/'|/,|/<|/.|/|/?]/g,"");
alert(str);
</script>
Extract html Chinese text using regular expressions
The code copy is as follows:
<script language="javascript">
str='<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Unt titled document</title></head><br/ >';
str=str.replace(/<[^>]*>|/g,"");
alert(str);
</script>