So I haven't used regular expressions before and I need to find a pattern in a text, thought I'd get some quick help here.

Consider the following text:

foobarimgres?imgurl\x3dhttp://www.mywebsite.com/picture.jpg\x26foobar

I want to locate the string right after imgres?imgurl\x3d and ending with \
(basically this the url of the picture).

I'm using C#'s RegEx.Matches that takes a string input and string pattern, and puts the matched results in a MatchCollection.
I don't know much about C# syntax, but here's how I would do it in sed:
sed -e 's/^.*imgres?imgurl\\\\x3d\(.*\)\\\\.*/\1/g'
Note that the syntax may vary a bit for C#. I'm particularly not confident this is how the backslash ('\') is escaped.

I hope this helped.
string requestUrl = "http://www.somewebsite.com/"; // there's actually a url here 
         
            HttpWebRequest request =(HttpWebRequest)WebRequest.Create(requestUrl);

            using (HttpWebResponse httpWebResponse = (HttpWebResponse)request.GetResponse())
            {
                using (Stream responseStream = httpWebResponse.GetResponseStream())
                {
                    using (StreamReader reader = new StreamReader(responseStream))
                    {
                       string html = reader.ReadToEnd(); // working, I now have a webpage's html

                     // MatchCollection mCollection = Regex.Matches(html, @"s/^.*imgres?imgurl\\\\x3d\(.*\)\\\\.*/\1/g"); this will give an error >> parsing "s/^.*imgres?imgurl\\\\x3d\(.*\)\\\\.*/\1/g" - Reference to undefined group number 1.
                        MatchCollection mCollection = Regex.Matches(html, Regex.Escape(@"s/^.*imgres?imgurl\\\\x3d\(.*\)\\\\.*/\1/g")); // no error, but no results as well
                       
                       foreach (Match m in mCollection)
                        {
                            string myNeededMatch = m.ToString();
                        }
                    }
                }
            }
It didn't work out rahmu, it might be a parsing problem ...

Here's the code - perhaps someone with knowledge in C# syntax can help me.
Didn't read everything just tried this real quick.
var result = Regex.Match(
                "foobarimgres?imgurl\\x3dhttp://www.mywebsite.com/picture.jpg\\x26foobar",
                @"\\x3d(.*)\\");

            Assert.IsTrue(result.Success);
            Assert.AreEqual(
                "http://www.mywebsite.com/picture.jpg",
                result.Groups[1].Value);
// The text I'm using here should return 2 results with @"\\x3d(.*)\\" , the pattern xterm suggested.
// I'm not familiar with Assert, I just went for the Group[].Value to try xterm's solution

var test = Regex.Match("foobarimgres?imgurl\\x3dhttp://www.web1.com/picture1.jpg\\x26foobarimgres?imgurl\\x3dhttp://www.web2.com/picture2.jpg\\",
                 @"\\x3d(.*)\\"); 
// test value: \\x3dhttp://www.web1.com/picture1.jpg\\x26foobar\\x3dhttp://www.web2.com/picture2.jpg\\
            
var result1 = test.Groups[0].Value; 
// result1 value: \\x3dhttp://www.web1.com/picture1.jpg\\x26foobar\\x3dhttp://www.web2.com/picture2.jpg\\

var result2 = test.Groups[1].Value;
// result2 value: http://www.web1.com/picture1.jpg\\x26foobar\\x3dhttp://www.web2.com/picture2.jpg
What I ideally want to get are:

result1: http://www.web1.com/picture1.jpg
result2: http://www.web2.com/picture2.jpg
Well requirements changed my friend.

You should be careful when using Regex for repeated captures, it might end up messy.

I'll give it a test today.
I'm using C#'s RegEx.Matches that takes a string input and string pattern, and puts the matched results in a MatchCollection.
I already stated that I'm aiming for several matches.

I appreciate your help xterm
PatrickSaad wroteThis worked out fine! Thanks xterm.
You will need to profile it as well as the regex one to see which one is less costly.

And even if the regex one ended up to be less costly you will have to use a relatively large input because regex search is exponential (tree).