skip to Main Content

I have hundreds of files with different content like as

public delete(entity: Model1): Observable<any> {

public delete(entity: ModelABC): Observable<any> {

and I want to add one more parameter in the method like as below using VS code replace:

public delete(entity: Model1, simulate: boolean): Observable<any> {

public delete(entity: ModelABC, simulate: boolean): Observable<any> {

I have tried with below expression. but, It does not work correctly.
Regex vs code

Any solution? How can I replace all the matching line with correct replacement?

2

Answers


  1. Chosen as BEST ANSWER

    This one helped me to replace all the files with new parameter:

    Replace file content with regex


  2. two error here :

    • First you need to catch the part you want to reuse with parenthesis.
    • Second, catch group starts from $1. ($0 contains the original match)

    So, to do what you want, you’ll need something like :

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search