enclose each character of string in {}
-
I have a long string of random characters, and I need each character enclosed in brackets.
For example, I want to transform
abcd
into
{a}{b}{c]{d}Can I do this with Notepad++? Or alternative suggestion please?
-
Using
- Search Mode = Regular Expression
- Find What=
. - and Replace With =
{$1}
you should get what you want.
update: sorry for the typo: as others clarified below, should be
{$0}----
Useful References
-
@PeterJones Thank you very much for your reply!
Close, but what that got me was:
{}{}{]{}In other words, a pair of empty brackets for each character.
-
I think @PeterJones made a typo; should be:
Replace With = {$0}
-
@Bill-Kristy, @PeterJones had a typo.
Regular expression search for
.
Replace with{$0}An alternative is to search for
(.)and to replace with{$1}$0in a replacement part is the entire thing that was matched in the search part.
$1in a replacement part is the first capture group which is the thing in(parentheses) -
@Alan-Kilborn @mkupper Thank you very much everyone, {$0} did the trick! Pure gold for me, thanks again!