Hi everyone, this is my first post. I use Visual Studio 2010.
I'm making a program that you post a bulk of text into in a certain format, the code then breaks down and saves certain areas of text as strings and variables, and finally it re-pastes it as a URL.
public void button1_Click(object sender, EventArgs e)
{
var list = textBox1.Text;
string title = showMatch(list, @"\w+\s+\d+\s+\w+\s+\W\d\d\W\d\d\W\d\d\s\d\d\S\d\d\W\s+.+");
string poster = showMatch(list, @"\w+\s+\d+\s+\w+\s+\W\d\d\W\d\d\W\d\d\s\d\d\S\d\d\W\s");
textBox2.Text = @"http://websitename=" + title + "moreofwebsitename" + poster + "moreofwebsitename" + comboBox1.SelectedItem + "moreofwebsitename=" + list;
}
public string showMatch(string text, string expr)
{
textBox1.Text = "";
MatchCollection mc = Regex.Matches(text, expr);
int i = 0;
string title = "";
foreach (Match m in mc)
{
title = "\n" + @m.Groups[i].ToString();
}
return title;
}
private void button2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("textBox2.Text");
}
The code captures the pieces I want well, apart from the final piece. The variable "list" is the original text inputted, and that also needs to be transferred to the URL. The problem is that the bulk of text is sent to the URL with no newline characters (%0A for http) and therefore only the first line is sent. There are no \n or \b characters that I can use the replace function to change.
In summary I need to find a way to locate the "hidden" newline escape characters in textBox1 and replace them with "%0A".
Thanks in advance and I hope this made sense,
Wiley