Syntax for regular expression search and replace. RRS feed

  • Question

  • I would like to search and change instance like:

    (string.Compare(testingConnections[i].Configuration, "CommerceServerCatalogConnectionString", StringComparison.OrdinalIgnoreCase) == 0)


    testingConnections[i].ConfigurationEquals("CommerceServerCatalogConnectionString", StringComparison.OrdinalIgnoreCase)

    So this involves regular expressions and it seems that VS's idea of regular expressions differ from the regular expressions used the System.Text.RegularExpression. I need to understand how VS matches a pattern, saves it in a variable and uses it in the replace expression. Like

    With "normal" regular expressions I would search for the pattern like:


    And replace with

    ${Variable}.Equals(${String}, ${Comparison})

    But I don't understand how this translates to the regular expressions that VS uses. Any ideas?

    Thank you.

    Kevin Burton

    Thursday, August 9, 2012 2:48 PM

All replies