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!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login