alaamido 0 Newbie Poster

Hi all I have a big two prblem in Regular expressions
The First: In the following string "My name is alaa and his name is is alaa" when I want to match all values that are before alaa so it should return (My name is ) and (My name is alaa and his name is is) because they are before alaa
A Code like this

        string text="My name is alaa and his name is alaa";
        MatchCollection m = Regex.Matches(text,@".+?(?=alaa)");
        foreach (Match t in m)
        {
            MessageBox.Show(t.Value);
        }

The result is (First Message :My name is )
(Second Message :alaa and his name is)
or it didnot return the string from the begining in case of second alaa(Second message)
Hpw can I solve this problem :(
Second One:
How can I handle Regular expressions quantifiers in case they are found in the string that we use in matching like

Regex.Match ("*^&%$?",".+?");

Pleeeeeease I want your help because there is a Regex task and I have to finish it quickly
Thanks in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.