TypeCobol icon indicating copy to clipboard operation
TypeCobol copied to clipboard

Replace : manage mix of colon and parenthesis in partialCobolWord

Open smedilol opened this issue 3 years ago • 0 comments

Describe the bug Some of our users use this kind of replace:

        replace ==(REJ)== by ==REJ==.

Cobol allow these characters as separators of partial Cobol word: : ( and ). You can mix these separators in any order and use an odd or even number of them.

Single separator

Replace Text surrounded by spaces Result
==REJ:== by ==REJ== REJ:-COD REJ-COD
==RE J:== by ==REJ== REJ:-COD No match
==RE     J:== by ==REJ== RE J:-COD REJ-COD
==REJ:== by ==REJ== AREJ:-COD No match
==R EJ:== by ==REJ== AR  EJ:-COD No match
==RE     J:== by ==REJ== :RE J:-COD :REJ-COD

2 separators

Replace Text surrounded by spaces Result
==(REJ)== by ==REJ== (REJ)-COD REJ-COD
==:REJ:== by ==REJ== (REJ)-COD No match
==)REJ(== by ==REJ== )REJ(-COD REJ-COD
==)REJ(== by ==REJ== (REJ)-COD No match
==(REJ)== by ==REJ== )REJ(-COD No match
==:REJ)== by ==REJ== :REJ)-COD REJ-COD
==(REJ:== by ==REJ== (REJ:-COD REJ-COD
==(REJ)== by ==REJ== (REJ:-COD No match
==:REJ:== by ==REJ== :REJ:-COD REJ-COD
==:R EJ:== by ==REJ== A:R EJ:-COD AREJ-COD
==(05)== by ==(09)== 01 AREJ-COD pic X(05). 01 AREJ-COD pic X(09).
==(05)== by ==09== 01 AREJ-COD pic X(05). 01 AREJ-COD pic X09.

More than 2 separators in Replace

Replace Text surrounded by spaces Result
==:REJ:-:== by ==REJ== :REJ:-COD No match
==:REJ:-:== by ==REJ== :REJ:-:COD REJCOD
==:REJ:-::== by ==REJ== :REJ:-:COD No match
==:REJ:-     :== by ==REJ== A:REJ:- :COD AREJCOD
==:R EJ:-     :== by ==REJ== A:REJ:- :COD No match
==:R EJ:-     :== by ==REJ== A:R  EJ:- :COD AREJCOD

Expected behavior Handle all these replaces !

smedilol avatar Nov 15 '21 17:11 smedilol