So I'm trying to find a string within a string, now I currently have this constructed in,
string str4;
var str5 = " type: '");
foreach (string str6 in response.Split(new char[] { '\n' }))
{
if (str6.StartsWith(str5))
{
str4 = str6.Replace(str5, "").Replace(" ", "").Replace("',", "");
break;
}
}
Which works as expected & will grab the text from
type: '
Example of this is
type: ' EXAMPLE ',
Ouput after loop
EXAMPLE
Now the issue is that occasionally the spaces at the start of ' type: ' vary, so sometimes it may be equal to the spaces I provided, and other times it may not..
I was trying to use Regex so I could do something such as,
string str5 = "Regex(*)type: '"
Now of course that's completely incorrect in terms of usage, but my example shows the use of * which would be equal to any possibilities, so therefore no matter on the number of spaces, I would still be able to extract the innertext from type.

str4,str5orstr6are good for R2-D2, not for humans. Choose speaking names likeresult(instead ofstr4),searchPattern(instead ofstr5),line(instead ofstr6).