简体   繁体   English

用regexp替换部分单词

[英]Replace part of word with regexp

I need to replace replaceString inside words, if it not starting with "@". 我需要替换单词中的replaceString ,如果它不以“@”开头。

For example: 例如:

replaceString - replaced to : replacedString
abc.replaceString - replaced to : abc.replacedString
abc.@replaceString - NOT replaced

Im trying to use something like @"(?!@)replaceString$" , but it not working properly. 我试图使用像@"(?!@)replaceString$" ,但它没有正常工作。

使用lookbehind而不是lookahead:

(?<!@)replaceString$

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM