I need to insert a string after a specific character using Ruby.
For example, if I have a line like the following:
(N D CGYRWIFGD2S7 0 1 N)(N D CGYCGYOVFBK0 0 N N)(ISA N N N CGYCG3FEXOIS N PUB NONE N N 0)(ISA N N N CGYCGYFGAOIS N PUB NONE N N 0)(ISA N N N CGYCG2FGAOIS N PUB NONE N N 0)(N D CGYCGYOVFBK1 0 N N)(N D CGYLOCFGA2S7 0 N N)(N D CGY01TFGD2S7 0 N N)(N D CGY01TCASUAL 0 N N)(N D CGYATTUSAOS7 0 1 N)(ISA N N N CGYAGTAD4OIS N PUB NONE 0 N 7)
I want to add an html tag <br />after each closing brace ")".
I think I can use a regex, but each line has a different number of brackets. So this particular line can have 5, and the other can 20. If my limited Ruby knowledge or programming is at all, I'm looking for help :)
Thanks!
source
share