Regular Expressions Margin

Free

A margin which exposes .Net Regular Expressions search and replace capabilities on a given code window. Toggle the margin by Alt+r. Navigate to next search by Alt+n. Navigate to previous earch by Alt+p. Escape key hides the margin and set focus back to the code window.

(2) Review
Visual Studio
2010
Download (2,793)
4/30/2010
3.0
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Description
Reviews (2)
Q and A (4)
Sign in to write a review
Sort by:

by Yasin Öner | July 21 2011

by CorwinAlex | April 27 2010

Sign in to start a discussion


  • VS 2012/2013 Support
    1 Posts | Last post February 26, 2014
    • Hi Fiona,
      Any chance for an update to support VS2012/2013?
      Thanks
  • Colour of margin
    11 Posts | Last post September 10, 2013
    • Hi,
      I really like your addin, but is there any way to change background colour of margin?
      Also can you add navigation to previous/next search results by using Up/Down keys when Find Next textbox is in focus (I think that this feature will be very useful)?
    • One more thing - can you move highlight marker under selection layer? It will look more "natural".
      Something like:
      [Order(After = PredefinedAdornmentLayers.Outlining, Before = PredefinedAdornmentLayers.Selection)]
      Thanks.
    • Hi Alex,
      
      Thanks for downloading my extension!  I love your idea about up/down arrow navigating to find results - I'll code that up.  Also, there is no way to change the background color right now, perhaps I should pick a system grey to blend in more with the shell background.  Do you have any suggestions?
      
      Also, right now I'm using classifier tags to highlight the matches, which is why they are ontop of the selection layer.  I'll change to using textmarker tags, which should be behind the selection layer.
      
      Regards,
      Fiona
    • Hey Alex,
      
      I have updated version 2.0 of Regular Expressions Margin with your feedback.  Thanks again!
      
      -Fiona
    • Hey, Fiona. I have only been using your add-on for 5 minutes, so I can comment on it yet, but I got an exception and I thought you should know of it. Here it is, taken from ActivityLog.xml:
      System.NullReferenceException: Object reference not set to an instance of an object.
      at FionaFung.RegexMarginPackage.RegexTagger.FindMatches(ITextSnapshot textSnapshot)
      at FionaFung.RegexMarginPackage.RegexTagger.textBuffer_Changed(Object sender, TextContentChangedEventArgs e)
      at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)
      
      It appeared when I moused over a "dot" in the margin, but not that indicating the cursor. The error failed to appear in subsequent mouse overs.
    • Addendum: I have another extension installed called Overview Margin. I think it might show the right side margin for the editor. The error occured when moving the mouse over it, while your Regex margin was not shown and the project was just loaded. Maybe that helps narrow it down.
    • Hi Fiona,
      That's great that you update your addin! I really love it :)
      About back colour - you can use one of VS colours (something like CommandBarGradientMiddle), so anyone can change it using Theme Editor. Anyway, default system colour looks pretty nice too.
      Also you can add few standard tricks from VS Find dialog:
      - You can copy selected text in code editor to "Find Next textbox" when user presses alt r;
      - If found word was out of text view, then you may scroll view, so this word will be centered in the view (for now it is placed in bottom or at the top of view). As I know for this feature may be used EnsureSpanVisible function.
      Thanks again for great addin :)
      
      P.S. I'm also using Overview Margin extension, but never experience any problems with both of this extensions.
    • Hey Siderite,
      
      I'm sorry that you ran into that exception.  I also have the overview margin installed so I'll play around with your scenario to try to repro.
      
      Hey CorwinAlex,
      
      Great suggestion about the autofilling of Find Next textbox and scrolling the result to view in the middle.  I'll investigate.
      
      Will keep both of you posted!
      
      -Fiona
    • Hi,
      
      I have fixed the exception, and updated the scrolling behavior so that we scroll the match to the middle of the screen if it's not currently visible.  Note that IEditorOperations.SelectAndMovecCaret(...) is great for this, simply pass in EnsureSpanVisibleOptions.ShowStart.  :)
      
      CorwinAlex, I thought more about autopopulating, and decided to not do that for now.  My workflow is that I bring up the regex margin and type in an expression, hit escape to hide the margin, navigate around the matches, then I want to bring the regex margin again to update my expression, and I don't want to lose what expression I had previously entered.  Great idea though!  This did make me think about doing a MRU list for the Find Next/Replace With textbox :)
      
      Regards,
      Fiona
    • Thank you for your quick reply and solution.
    • I tried running it on vs2012 but it does nothing.
      do you plan on adding support for vs2012?
      I have used your tool to get better acquainted with regex, and it has helped me immensely. I wish to continue to use it on vs2012
      
  • opa
    1 Posts | Last post October 16, 2011
    • It seems it does not highlights js though coffescript highlights. Can it be fixed? Thanks.
  • "Replace all" not working when the regex contains line start (^), line end ($) ?
    1 Posts | Last post January 26, 2011
    • "replace all" seems not to do anything some of the time. I haven't spent much time testing it but it seems to possibly depend on whether the regex contains line start and end markers?
      
      Seems like a great extension otherwise, BTW.