Regex in Find-and-replace in Visual Studio for left-angle brackets
July 18th, 2009
No comments
My problem is simple. Sandcastle requires encoded html to parse correctly. Having generics in the documentation causes it to break. I need to replace the '<'
with <
. I just now need to do this by the solution in Visual Studio. Of course, microsoft requires me to know another regex set of expresssions: http://msdn.microsoft.com/en-us/library/2k3te2cs(VS.80).aspx
Here’s the simple regex:
- Find:
///{.*}{[^:b\>\.]}(\<)
- Replace:
///<
The regex looks for a left angle bracket on the end of a word (ie no space, no period). This means that it also leaves html in place.
Note: I wouldn’t do a global replace but use it to step through each.
Before:
/// <summary> /// Used for testing the redirection of action on successful and failing calls to an action. /// <example> /// [TestClass] /// public class UserControllerRedirectsTest /// { /// [TestMethod] /// public void SuccessfulCreateRedirectsToIndex() /// { /// Controller<UserController> /// .ShouldRedirectTo(ResfulAction.Index) /// .IfCallSucceeds() /// .WhenCalling(x => x.Create(null)); /// </example> /// </summary> /// <typeparam name="T"></typeparam>
After:
/// <summary> /// Used for testing the redirection of action on successful and failing calls to an action. /// <example> /// [TestClass] /// public class UserControllerRedirectsTest /// { /// [TestMethod] /// public void SuccessfulCreateRedirectsToIndex() /// { /// Controller<UserController> /// .ShouldRedirectTo(ResfulAction.Index) /// .IfCallSucceeds() /// .WhenCalling(x => x.Create(null)); /// </example> /// </summary> /// <typeparam name="T"></typeparam>