Re: problem using Regex in a C# addin
From: Sijin Joseph (sijindotnet_at_hotmail.com)
Date: 04/06/04
- Next message: Sijin Joseph: "Re: How to stop check-out on add to project?"
- Previous message: Barns: "Search and Index side bars don't 'pop out'"
- In reply to: Tom Hughes: "problem using Regex in a C# addin"
- Next in thread: Tom Hughes: "Re: problem using Regex in a C# addin"
- Reply: Tom Hughes: "Re: problem using Regex in a C# addin"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 6 Apr 2004 16:27:01 +0530
Macros in VS.Net don't use the .Net regular expressions synatx, they use the
old VS6 regular expressions syntax, look that up in the documentation. That
might be your problem
-- -Sijin Joseph http://weblogs.asp.net/sjoseph "Tom Hughes" <tom_hughes98@yahoo.com> wrote in message news:a6e410db.0404051156.39b5a8be@posting.google.com... > hi- > > i'm trying to comment out a statement in an addin using Regex with the > following code. in addition to the comment characters, i'm adding a > special character so that the statements can be restored at a later > time. in a stand-alone program the replacement works without problem. > the addin code fouls the formatting for some reason. here's the > code... > > string s, t, sPattern; > > ((TextSelection) dte.ActiveDocument.Selection).SelectAll(); > s = ((TextSelection) dte.ActiveDocument.Selection).Text; > sPattern = "^(?<log_statement>[ \\t]*log\\()"; > Regex regex = new Regex( sPattern, RegexOptions.Multiline ); > t = regex.Replace( s, "//#${log_statement}" ); > ((TextSelection) dte.ActiveDocument.Selection).Text = t; > > i have compared 's' and 't' character by character and the strings > look as they should (ie. the regex replacement appears to be working). > is there some encoding voodoo i need to do? are there other ways to > set the active document's text? > > thanks, > tom
- Next message: Sijin Joseph: "Re: How to stop check-out on add to project?"
- Previous message: Barns: "Search and Index side bars don't 'pop out'"
- In reply to: Tom Hughes: "problem using Regex in a C# addin"
- Next in thread: Tom Hughes: "Re: problem using Regex in a C# addin"
- Reply: Tom Hughes: "Re: problem using Regex in a C# addin"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|