我有txtSrcUserID 文本框。我想从下面的句子中删除用户输入的单词。
此代码帮助我删除“USER1”。从下面关于richtexbox1的句子。但根据用户输入,单词会改变,所以我需要动态删除单词......
Regex reg = new Regex("(ALTER TABLE .+ REFERENCES\\s+)\"USER1\"[.](.+)");
richTextBox1.Text = reg.Replace(richTextBox1.Text, "$1$2");
我的句子
ALTER TABLE "GRADE" ADD CONSTRAINT "GR_ENR_FK" FOREIGN KEY ("STUDENT_ID","SECTION_ID") REFERENCES "USER1"."ENROLLMENT"("STUDENT_ID","SECTION_ID") ENABLE;
ALTER TABLE "GRADE" ADD CONSTRAINT "GR_GRTW_FK" FOREIGN KEY ("SECTION_ID","GRADE_TYPE_CODE") REFERENCES "USER1"."GRADE_TYPE_WEIGHT"("SECTION_ID","GRADE_TYPE_CODE") ENABLE;
使用我的代码语句后将修改如下:
ALTER TABLE "GRADE" ADD CONSTRAINT "GR_ENR_FK" FOREIGN KEY ("STUDENT_ID","SECTION_ID") REFERENCES "ENROLLMENT"("STUDENT_ID","SECTION_ID") ENABLE;
ALTER TABLE "GRADE" ADD CONSTRAINT "GR_GRTW_FK" FOREIGN KEY ("SECTION_ID","GRADE_TYPE_CODE") REFERENCES "GRADE_TYPE_WEIGHT"("SECTION_ID","GRADE_TYPE_CODE") ENABLE;
*我想要这样的东西,那么我在哪里可以在下面的代码中添加 txtSrcUserID *
Regex reg = new Regex("(ALTER TABLE .+ REFERENCES\\s+)\"txtSrcUserID\"[.](.+)");
richTextBox1.Text = reg.Replace(richTextBox1.Text, "$1$2");