using uCalcSoftware; var uc = new uCalc(); var CommentTransform = uc.NewTransformer(); var CommentTokens = CommentTransform.Tokens; CommentTokens.Add("."); CommentTokens.Add("[a-z]+"); var txt = "'This is it' /* 'This is it' This is it */ This is it"; var t = uc.NewTransformer(); t.FromTo("is", ""); Console.WriteLine(t.Transform(txt).Text); // Now the context will switch between /* and */ // In that context there's no quoted text token, t.Tokens.ContextSwitch(CommentTokens, "/\\*", "\\*/"); t.FromTo("is", ""); Console.WriteLine(t.Transform(txt).Text);