I am tying to replace this:
:b:b:b:b:b:b:b:bvoid Page_Load\(\)\n:b:b:b:b:b:b:b:b\{\n:b:b:b:b:b:b:b:b:b:b:b:b
by this
:b:b:b:b:b:b:b:bvoid Page_Load\(\)\n:b:b:b:b:b:b:b:b\{\n:b:b:b:b:b:b:b:b:b:b:b:bmyclass.dateclass.activite\(Request.ServerVariables\[\"LOGON_USER\"\].Split\('\\\\'\)\[1\], Request.Url.AbsoluteUri\);\n:b:b:b:b:b:b:b:b:b:b:b:b
. I do find the first expression using FIND, but it says that it can't find 开发者_C百科it when I use REPLACE.
Here is a sample of my code
//Affichage de la page
void Page_Load()
{
myclass.dateclass.activite(Request.ServerVariables["LOGON_USER"].Split('\\')[1], Request.Url.AbsoluteUri);
java.Text = "<script language=\"JavaScript1.2\" type=\"text/javascript\">var sess = \"" + Session["username"] + "\";var user = \"" + Request.ServerVariables["LOGON_USER"].Replace("\\", "\\\\") + "\";</script>";
Session.LCID = 3084; //Utilise des dates en format AAAA-MM-JJ
You don't need to escape round brackets or quotes when using them in the replacement string, nor does it recognise certain character codes, including :b
.
Firstly, change your find string to this (the curly braces around the outside are VS's own idiosyncratic way of defining a capture group):
{void Page_Load.+\n[^\{]+\{}
Then, change your replacement string to this (note the \1
to refer to the capture group in the replacement).
\1\nmyclass.dateclass.activite(Request.ServerVariables\["LOGON_USER"\].Split('\\\\')\[1\], Request.Url.AbsoluteUri);\n
The "the following specified text was not found" error that Visual Studio gives you back is actually wrong - it's an issue with the replacement string rather than the string to find.
It's probably worth downloading something like this Regex Search and Replace Addin to save you the headache of having to deal with Visual Studio's bizarre regex syntax.
精彩评论