正则表达式删除“= \ r”(Regex to remove “=\r”)
以下是我拥有的文字:
[ ' "message": "WorldStage Supports Massive 4K Video Mapping at Adobe MAX=\r with Christie Boxer 4K Projectors', ' "message": "Inside Track: Trading Focus on Shares of Adobe Systems In=\r c. (ADBE)' ]我希望它看起来像:
[ ' "message": "WorldStage Supports Massive 4K Video Mapping at Adobe with Christie Boxer 4K Projectors', ' "message": "Inside Track: Trading Focus on Shares of Adobe Systems Inc. (ADBE)' ]正则表达式我试过了:
texts[i].replace(/=\\r/g, "")但它不起作用。 可以在StackOverflow中找到类似的问题。 :(
Here's the text I have:
[ ' "message": "WorldStage Supports Massive 4K Video Mapping at Adobe MAX=\r with Christie Boxer 4K Projectors', ' "message": "Inside Track: Trading Focus on Shares of Adobe Systems In=\r c. (ADBE)' ]I want it to look like:
[ ' "message": "WorldStage Supports Massive 4K Video Mapping at Adobe with Christie Boxer 4K Projectors', ' "message": "Inside Track: Trading Focus on Shares of Adobe Systems Inc. (ADBE)' ]Regex I tried:
texts[i].replace(/=\\r/g, "")But it is not working. Could find similar issues at StackOverflow. :(
最满意答案
您的正则表达式 - /=\\r/g - 匹配a = , \和r所有实例。
您似乎想要删除符号后的所有=和换行符的实例。
使用
.replace(/=[\r\n]+/g, "")=[\r\n]+匹配a = ,并且[\r\n]+匹配在字符类LF(换行符号\n )和CR(回车符\r )中定义的一个或多个字符。
Your regex - /=\\r/g - matches all instances of a =, \ and r.
You seem to want to remove all instances of = and line breaks after the symbol.
Use
.replace(/=[\r\n]+/g, "")The =[\r\n]+ matches a =, and [\r\n]+ matches 1 or more characters defined in the character class, LF (newline symbol, \n) and CR (carriage return, \r).
更多推荐
发布评论