i have this example string this is part of the section in the string forward slash must be at the end
declare @mytable nvarchar (50) = 'one_table';
declare @mydata nvarchar(255) = 'C:\foo\bar\test\date\';
--DECLARE @test nvarchar (50) = '20140101';
no i like to replace the line forward slash must be at the end:
declare @mydata nvarchar(255) = 'C:\foo\bar\test\date\';
with this line :
declare @mydata nvarchar(255) = 'D:\test\test\foo\b\';
i try to replace it like this db_script is list that conatins conatins the script :
pattern = '.*declare.*\@mydata.*nvarchar\(255\).*$'
dest = 'declare @mydatanvarchar(255) = \'D:\test\test\foo\b\';'
for command in db_script:
command = re.sub(pattern, dest, command)
print(command)
even if i isolate the line like this forward slash must be at the end:
ll = 'declare @mydata nvarchar(255) = \'C:\foo\bar\test\date\';'
pattern = '.*declare.*\@mydata.*nvarchar\(255\).*$'
dest = 'declare @mydata nvarchar(255) = \'D:\test\test\foo\b\';'
command = re.sub(pattern, dest, ll)
i can't catch the result in command.
if i test it in regexp tester all working
what I'm doing wrong?