I find your description very confusing , I have no certainty of what you require
please provide an input sample, as well as your desired output
for example, ( loosely based on your description )
Input
Code:
This is some random text
this line contains 'a random string of characters ' in single quotes
Desired Output
Code:
This is some random text
this line contains 'test' in single quotes
this sed would achieve that
Code:
sed "s/'.*'/'test'/" Input
Edit, I should have refreshed before posting