简体   繁体   English

如何使用Regex从句子中删除特定的字符串?

[英]How can I remove specific strings from a sentence using Regex?

I have this following sentence: Crazy Fredrick bought many very exquisite opal jewels. 我有以下这句话: Crazy Fredrick bought many very exquisite opal jewels. and I need to use regex in the following format: 我需要使用以下格式的正则表达式:

Crazy Fredrick bought many very exquisite opal jewels.".replace(/regex goes here/gi,"")

to get the following result: Crazy bought very opal jewels. 得到以下结果: Crazy bought very opal jewels.
So how can i use regex to query out those specific parts of the sentence? 那么我如何使用正则表达式查询句子的那些特定部分呢?

.replace(/(Fredrick|many|exquisite)/gi,"")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用正则表达式匹配包含特定单词的每个句子? - How can I match every sentence that contains a specific word using regex? 如何使用正则表达式捕获特定字符串中的特定字符? - How can I capture a specific char inside specific strings with regex? 如何大写和删除句子/字符串中的空格? - How can I capitalize and remove spaces from a sentence/string? 我如何使用正则表达式获取两个特定字符串之间的字符串? - How can i obtain a string between two specific strings using regex? 如何使用正则表达式删除带有imacros eval的文本中的最后一个句子 - How to remove last sentence in text with imacros eval using regex 我如何使用正则表达式从字母字符串中删除特定字母 - how do i remove specific letters from alphabet string using regex 如何使用正则表达式从字符串中删除特定字符串 - How to remove specific string from string using regex 使用正则表达式,我怎样才能在句子中得到“músicas”或“áaudio”这个词? - Using Regex, how can I get the words "músicas" or "áudio" in a sentence? 如何从Javascript中的数组中删除带有空字符串的对象? - How can I remove objects with empty strings from array in Javascript? 如何从状态数据的字符串中删除HTML标记? - How can I remove HTML markup from strings in state data?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM