追加和prepending在字符串'#'仅使用正则表达式字符串、正则表达式、prepending

由网友(浮夸了我的年华°)分享简介:我是新来的正则表达式和最近面临这个问题。追加和prepending仅使用正则表达式的字符串'#'在此假设我们有字符串,如你好,我的名字是#First名称#@EducationDetail @ 现在我不得不追加和prePEND #在此只使用常规EX pression因此,它将成为#Hello我的名字是#First名称#...

我是新来的正则表达式和最近面临这个问题。

       

追加和prepending仅使用正则表达式的字符串'#'

  

在此假设我们有字符串,如你好,我的名字是#First名称#@EducationDetail @

现在我不得不追加和prePEND 在此只使用常规EX pression因此,它将成为

#Hello我的名字是#First名称#@EducationDetail @#

感谢

解决方案

VAR RES = Regex.Replace(输入,@^(*)$,#$ 1号);

如何在excel中实现两个字符串拼接

I am new to regex and recently faced this problem

Appending and Prepending '#' in an string using only Regex

In this suppose we have string such as Hello my name is #First Name# @EducationDetail@

Now I have to append and prepend # in this using only regular expression so it will become

#Hello my name is #First Name# @EducationDetail@#

Thanks

解决方案

var res = Regex.Replace(input, @"^(.*)$", "#$1#");

阅读全文

相关推荐

最新文章