Regex for Find and Replace across multiple lines RRS feed

  • Question

  • I have a tsql file open and doing a Find and Replace in VS 2017. I am a regex newbie.  I have several similarly named fields that need to have their size changed.

    For example, want to fine the 12 column names that match the following pattern GZBDGMVP[0-9][0-9]

    GZBDGMVP01 decimal(5,1)
    GZBDGMVP12 decimal(5,1)

    and change to 

    GZBDGMVP01 decimal(6,1)
    GZBDGMVP12 decimal(6,1)

    sometimes it is broken across two lines


    also confused about the REPLACE part. How to keep everything original (like the column name) but only change the 5 to a 6

    Friday, May 4, 2018 3:28 PM

All replies

  • Try the next expression:


    The replacement is:


    • Edited by Viorel_MVP Friday, May 4, 2018 4:24 PM
    Friday, May 4, 2018 4:20 PM
  • First, I added tab |\t to the string of special character. But no matches were returned.  


    Then shorted the Find to below and it returned my matches, but guessing that I need the other stuff for the REPLACE


    • Edited by TheBrenda Friday, May 4, 2018 6:40 PM
    Friday, May 4, 2018 6:25 PM
  • Viorel_ - can you help me out. want to understand.  Your suggested Find does not work for this example. 


    GZBDGYVP01 (decimal 5, 1) NOT NULL,

    Monday, May 7, 2018 2:19 PM