I want to substitute the following:
default by <http://www.mycompany.com/>
db: by <http://www.mydbcompany.com/>
I have data of the following format:
<a> <b> <c>.
<d> db:connect <e>.
db:start <f> <g>.
<h> <i> "hello".
Now I want to transform this data into the following form:
<http://www.mycompany.com/a> <http://www.mycompany.com/b> <http://www.mycompany.com/c>.
<http://www.mycompany.com/d> <http://www.mydbcompany.com/connect> <http://www.mycompany.com/e>.
<http://www.mydbcompany.com/start> <http://www.mycompany.com/f> <http://www.mycompany.com/g>.
<http://www.mycompany.com/h> <http://www.mycompany.com/i> "hello".
Now the way I am trying to achieve the desired format is to separate to break each line by using:
line1=re.split('(?<=)\s+(?=<)',line)
and then for line1[0], line1[1], line1[2] I try to
substitute < by <http://www.mycompany.com/
However, my problem is that this approach does not work for db: and quotes. Is there some way by which I may achieve the desired output in python