In this case,
s{CO}{C/O}g
would do. If there's a chance of overlap between the two patterns to separate (e.g. putting "/" between "AC" and "CA"), you need a lookahead.
s{AC(?=CA)}{AC/}g
or
s{AC\K(?=CA)}{/}g
In reply to Re: How to insert a "/" within a string?
by ikegami
in thread How to insert a "/" within a string?
by rsvp1920
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |