regex - regular expressions for selecting multiple lines -
i have text file in particular format..
!c_xyz|crby=112|crdate=12jun11|mdby=112|mddate=12jun11|desc=xyz asdasda........................................................ asddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd !c_abc|crby=112|crdate=12jun11|mdby=112|mddate=12jun11|desc=xyz... i need regular expression reformat file using find , replace - visual studio. desc field value has overflowed onto next lines. need move them actual line. final string should
!c_xyz|crby=112|crdate=12jun11|mdby=112|mddate=12jun11|desc=xyzsdasda.........asdddddd.. !c_abc|crby=112|crdate=12jun11|mdby=112|mddate=12jun11|desc=xyz... i need re "desc=" followed until next ! symbol
find desc=([^\|\r\n]+)[\r\n](([^!\r\n][^\r\n]+[\r\n])*), replace desc=\1\2 , repeat until every line starts ! (you can test using ^[^!] search expr should find nothing).
alternatively find [\r\n]+, replace empty string. thereafter find !, replace \r\n!. suggestion has 2 drawbacks. temporarily produces long lines editor (notably vs) may or may not have difficulties , processes descriptions containing ! incorrectly.
addendum: input seems fixed format desc section. if indeed, can apply alternative #2, step 1, being followed search/replace run using (!.{53}\|desc=)/[\r\n]\1.
Comments
Post a Comment