I've scoured Stack Overflow for something just like this and can't seem to come up with a solution. I've got some text that looks like this:
command.Parameters.Add("@Id
command.Parameters.Add("@IsDeleted
command.Parameters.Add("@MasterRecordId
command.Parameters.Add("@Name
...
And I would like the text to end up like this:
command.Parameters.Add("@Id", acct.Id);
command.Parameters.Add("@IsDeleted", acct.IsDeleted);
command.Parameters.Add("@MasterRecordId", acct.MasterRecordId);
command.Parameters.Add("@Name", acct.Name);
...
As you can see, I essentially want to append the end of the line with: ", acct.<word between @ and second ">);
I'm trying this:
Find What: (?<=@).+?(?=\r)
- This works, it finds the appropriate word.
Replace: \1", acct.\1);
- This doesn't. It changes the line to (for Id):
command.Parameters.Add("@", acct.
Not sure what I'm doing wrong. I thought that \1
is supposed to be the "capture" from the "Find what" box, but it's not I guess?