| |

VerySource

 Forgot password?
 Register
Search
Author: 浮升萧条

Urgent: Find a replacement regular, such as: [by: 郑信涛], [01: 18.50], [ar: 同 恩] That is, replace [content]

[Copy link]

2

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-2-9 11:45:01
| Show all posts
I mean to replace the entire "[01:02:03]" with nothing. Your method doesn't work either,
But I found a stupid way to succeed.

string str = "[01: 19.50] I [01: 19.58] love you !!! [01: 19.58] [No!] [He is almost a neurosis] [Say this to someone the first time I meet] <br> Sorry. Are you sick! ";
str = str.Replace ("[", "Temp"). Replace ("]", "Temp");
Response.Write (System.Text.RegularExpressions.Regex.Replace (str, "Temp. *? Temp", ""));

Getting my intended purpose, the result is output:
I love you!!!
Sorry. Are you sick?
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-25 16:15:01
| Show all posts
MatchCollection mc = Regex.Matches(myStr, @"\[.*?\]", RegexOptions.IgnoreCase);
                 foreach (Match m in mc)
               {
                     mTable =m.Value.ToString();
              }

This can be found, I have tried it. Then you just need to replace
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list