.NET Tips and Tricks

Blog archive

How to Use Regular Expressions in Visual Studio Find

I have to admit that I've never really understood regular expressions. But if there was any reason that I was going to learn to use them, it would be when doing searches in Visual Studio.

For one thing, regular expressions are easy to invoke when doing a search: When you press Ctrl_F to get the Find dialog box, all you have to do is click the asterisk (*) to the left of the of scope dropdown list to start using regular expressions in your search.

I think, for example, I'm ready to start using the period (which matches a single character) in my searches. That would let me (for example) search for any string that begins with a and ends with p that has only one character in between (a.p). I not only understand this, but it's also easy to extend: Looking for a and p with two characters in between is a..p.

Where I could see being even more successful is by using Replace in Files more. When you open Replace in Files there's a Use Regular Expressions option tucked in under Find Options. Checking off that option enables the button at the end of the "Find what" text box. I like that button because clicking on it produces a quick study guide for regular expression newbies like me. I could do this.

I mean: it's certainly possible that I could learn something new. Unlikely, but possible.

Posted by Peter Vogel on 05/30/2019


comments powered by Disqus

Featured

  • Microsoft Revamps Fledgling AutoGen Framework for Agentic AI

    Only at v0.4, Microsoft's AutoGen framework for agentic AI -- the hottest new trend in AI development -- has already undergone a complete revamp, going to an asynchronous, event-driven architecture.

  • IDE Irony: Coding Errors Cause 'Critical' Vulnerability in Visual Studio

    In a larger-than-normal Patch Tuesday, Microsoft warned of a "critical" vulnerability in Visual Studio that should be fixed immediately if automatic patching isn't enabled, ironically caused by coding errors.

  • Building Blazor Applications

    A trio of Blazor experts will conduct a full-day workshop for devs to learn everything about the tech a a March developer conference in Las Vegas keynoted by Microsoft execs and featuring many Microsoft devs.

  • Gradient Boosting Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the gradient boosting regression technique, where the goal is to predict a single numeric value. Compared to existing library implementations of gradient boosting regression, a from-scratch implementation allows much easier customization and integration with other .NET systems.

  • Microsoft Execs to Tackle AI and Cloud in Dev Conference Keynotes

    AI unsurprisingly is all over keynotes that Microsoft execs will helm to kick off the Visual Studio Live! developer conference in Las Vegas, March 10-14, which the company described as "a must-attend event."

Subscribe on YouTube