I'm trying to replace a string with empty space("") after a specific character(colon) ":"
example:2017 - Alpha Romeo United kingdom : New vehicle (by abc)
I want out put as "2017 - Alpha Romeo United kingdom"
You could do it using the following regex (using capturing group and positive lookahead) :
input        >>  2017 - Alpha Romeo United kingdom : New vehicle (by abc)
regex search >>  (?=:):(.*)
replace with >>  " "
output       >>  2017 - Alpha Romeo United kingdom
smarty
{
    assign
    var = "articleTitle"
    value = "2017 - Alpha Romeo United kingdom : New vehicle (by abc)"
} {
    $articleTitle | regex_replace: "/(?=:):(.*)/": " "
}
 
    
         private void Form1_Load(object sender, EventArgs e)
    {
        string str = "2017 - Alpha Romeo United kingdom : New vehicle (by abc)";
        str = Regex.Replace(str, @":+(.*)", "");
        MessageBox.Show(str);
    }
