问题描述
您好,此代码有效.但是在这里,我们在richtextbox中获得输出,而不是我希望提取的数据在其他文本框中.我怎样才能做到这一点?提前谢谢.
Hi, this code is working. But here we get output in richtextbox, instead of this I want the extracted data to be in a different textbox. How can I achieve this? Thanks in advance.
string content = "?$255*$50*$50*?";
string pattern = @"(\d+)";
MatchCollection mc = Regex.Matches(content, pattern);
string spacer = "";
if (mc.Count > 0)
{
Console.WriteLine("Printing matches...");
for (int i = 0; i < mc.Count; i++)
{
spacer = "";
richTextBox1.AppendText(spacer + "Match[" + i + "]: " + mc[i].Value);
GroupCollection gc = mc[i].Groups;
}
}
else
{
richTextBox1.AppendText("Pattern Not Found");
}
在richtextbox o/p
匹配[0]:255
匹配[1]:50
匹配[2]:50
但我想要像
的o/ptextbox1 = 255
textbox2 = 50
textbox3 = 50 plz帮助.
in richtextbox o/p
Match[0]: 255
Match[1]: 50
Match[2]: 50
but i want o/p like
textbox1 = 255
textbox2 = 50
textbox3 = 50 plz help.
推荐答案
在richtextbox o/p
匹配[0]:255
匹配[1]:50
匹配[2]:50
但我想要像
的o/ptextbox1 = 255
textbox2 = 50
textbox3 = 50 plz帮助.
in richtextbox o/p
Match[0]: 255
Match[1]: 50
Match[2]: 50
but i want o/p like
textbox1 = 255
textbox2 = 50
textbox3 = 50 plz help.
这篇关于使用正则表达式模式在不同的文本框中提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!