如果不以“string”结尾,请使用正则表达式替换 [英] Replace with regex if does not end with "string"

查看:81
本文介绍了如果不以“string”结尾,请使用正则表达式替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在整个文档中使用正则表达式替换匹配。但我希望它只能替换匹配,如果它还没有被替换。或者它以某个字符串结尾,例如完成

I am replacing a match using regex in the whole document. But I want it to ONLY replace the match if it hasn't already been replaced. or it ends with a certain string like "done"

推荐答案

很难从你的问题中准确地告诉你需要什么。总的来说,有助于您了解如何使用RegEx的更多信息。一个非常有用的网站是 regexlib [ ^ ]他们有一个庞大的正则表达式库。他们还有一个 RegEx测试人员 [ ^ ]这对测试您的RegEx代码非常有帮助。 Ultrapico的 Expresso [ ^ ]是一个非常有用的工具,用于创建正则表达式。
It is hard to tell from your question exactly what you need. Something that will help you in general is to learn more about how to use RegEx. A very helpful site is regexlib [^]they have a large library of Regular Expressions. They also have a RegEx tester[^] which is very helpful in testing your RegEx code. Also Ultrapico's Expresso[^] is a very useful tool for creating regular expressions.


这里提供了一个答案:复制父项的所有节点并将其附加到父节点用每个副本替换属性 [ ^ ]
An answer has been provided here: Copy all nodes of a parent and append it in the parent node replacing the attribute with each copy[^]


您显示的模糊示例与RefEx代码和保存代码与上述内容无关。

请记住,我们不在您的脑海中,我们看不到您的屏幕。

提出问题是一种技巧 [ ^ ]
You show a vague example which do not match the RefEx code and the save code is unlinked to the above.
Remember, we are not in your head, we don't see your screen.
Asking questions is a skill[^]


这篇关于如果不以“string”结尾,请使用正则表达式替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆