none
Using Wild Cards with Find/Replace function in VS2013

    Question

  • I have a module that has thousands of lines of code.  I have about 160 Fields that I need to change from A to B.

    Example:
    enumMyEnum.eField1
    enumMyEnum.eField2
    enumMyEnum.eField3

    I need to change to:
    .Columns(enumMyEnum.eField1)
    .Columns(enumMyEnum.eField2)
    .Columns(enumMyEnum.eField3)

    Is there a way I can structure (using wild cards perhaps?) my Find/Replace to change all the items in my mod?

    Thursday, January 28, 2016 5:36 PM

Answers

  • Try this regular expression:

        \benumMyEnum[.]eField(\d+)\b

    and this replacement term:

        .Columns(enumMyEnum.eField$1)

    Thursday, January 28, 2016 5:53 PM
  • Thank you Viorel your post actually got me going in the right direction.
    I ended up finding this site http://regexr.com/

    which  I used to help me come up with this:
    Find:\benumSHPWhseGrid(.)*\b

    Replace:.Columns($&)

    It is working much better than changing each one manually.

    Thursday, January 28, 2016 7:47 PM

All replies

  • Try this regular expression:

        \benumMyEnum[.]eField(\d+)\b

    and this replacement term:

        .Columns(enumMyEnum.eField$1)

    Thursday, January 28, 2016 5:53 PM
  • I cant seem to get the Find/Regular Expression to find anything.
    Here is an example of my real enum's:

    enumSHPWhseGrid.eshpwFirstName
    enumSHPWhseGrid.eshpwLastName
    enumSHPWhseGrid.eshpwPhone

    I need them to be:
    .Columns(enumSHPWhseGrid.eshpwFirstName)
    .Columns(enumSHPWhseGrid.eshpwLastName)
    .Columns(enumSHPWhseGrid.eshpwPhone)

    I try and do this and it finds nothing:

    \benumSHPWhseGrid[.]eshpw(\d+)\b

    I am fairly certain this expression is incorrect...but I dont know enough to modify it so that it will work correctly.


    Thursday, January 28, 2016 6:51 PM
  • Thank you Viorel your post actually got me going in the right direction.
    I ended up finding this site http://regexr.com/

    which  I used to help me come up with this:
    Find:\benumSHPWhseGrid(.)*\b

    Replace:.Columns($&)

    It is working much better than changing each one manually.

    Thursday, January 28, 2016 7:47 PM