I want to find the string enclosed by string1 and string2 and replace it with something else. I got a few lines that look something like
some_string_and_string1_some_rndom_string_string2_and_more
sme_string_and_string1_some_random_string_string2_and_more
some_string_and_string1_some_random_string_string2_and_mre
...
I thought the regex to match everything enclosed by string1 and string2 is
/^string1.*string2$
So the regex would match
string1_some_rndom_string_string2
string1_some_random_string_string2
string1_some_random_string_string2
...
But if I select the lines and try
:'<,'>s/^string1.*string2$
I get
Pattern not found: ^string1.*string2$
What am I doing wrong?