c++ - 如何查找和替换这段文本???
PHP中文网
PHP中文网 2017-04-17 12:06:25
0
2
749
PHP中文网
PHP中文网

认证0级讲师

reply all(2)
大家讲道理

Let me explain why the regular expression above can succeed.
$number replaces the matched number group with a replacement expression, which returns the stored value found during pattern matching. of the nine most recent parts. Each time a successful bracketed match occurs, the values ​​of the $1...$9 attributes are modified. Any number of parenthesized submatches can be specified in a regular expression pattern, but can only store the latest nine

For example
Regular expression/(w+)@(w+).(w+)/g
Text to be matchedadress helloworld@gmail.com
Here = helloworld , S2 = gmail , =com

Use $1 in replace to refer to the first saved submatch. If there are multiple submatches, you can use $2, $3, etc. to continue to reference
such as

public static void Main()
{ 
 string s = "1 12 3 5";
 s = Regex.Replace(s,@"(\d+)(?#这个是注释)","0",RegexOptions.Compiled|RegexOptions.IgnoreCase);
 Console.WriteLine(s);
 Console.ReadLine();
 }

Output result: 01 012 03 05

Using your text, the Chinese character in the middle will be replaced with $1, each time it is replaced with $1, which is the corresponding text

左手右手慢动作

I know the answer. A master in the Q group taught me: replace QSTR("(.*)") with QSTR(tr("$1"))

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template