PlaceholderAPI extension to replace Strings. Works with ALL characters!
The basic syntax is:
%replace_<search>_<replacement>_<text>%
<search>
is the String to search for.<replacement>
is the String to replace the search String with.<text>
is the String to search in.
If the <search>
or <replacement>
part contains one or more underscores, you have to put that part
into `backticks`
:
%replace_`<search_with_underscores>`_<replacement>_<text>%
If both <search>
and <replacement>
contain underscores, you have to put both parts into backticks:
%replace_`<search_with_underscores>`_`<replacement_with_underscores>`_<text>%
The <text>
part never requires backticks.
If your <search>
or <replacement>
contains any backticks, you have to escape them with a backslash:
%replace_<search_with_\`_backticks\`>_<replacement_with_\`_backticks\`>_<text>%
To use a literal backslash, you have to escape it with another backslash only if the <search>
or <replacement>
part
is in backticks:
%replace_`<search_with_\\_backslash>`_<replacement>_<text>%
If the <search>
or <replacement>
part is not in backticks, you don't have to escape the backslash:
%replace_<search_with_\_backslash>_<replacement>_<text>%
- Replace
foo
withbar
inmy name is foo
:- Placeholder:
%replace_foo_bar_my name is foo%
- Result:
my name is bar
- Placeholder:
- Replace underscores with spaces in
my_name_is_foo
:- Placeholder:
%replace_`_`_` `_my_name_is_foo%
- Result:
my name is foo
- Placeholder:
- The
<text>
part never requires escaping:- Placeholder:
%replace_foo_bar_My name is `foo`!%
- Result:
my name is `bar`!
- Placeholder:
You can declare certain "templates" in the PlaceholderAPI main config.yml, for example like this:
expansions:
replace:
templates:
worldnames: # Replaces world names with fancier ones
- search: world
replace: "&aOverworld"
- search: world_nether
replace: "&cNether"
- search: world_the_end
replace: "&9The End"
You can then use these templates in your placeholders and even use nested placeholders, like this:
%replace_template_worldnames_{player_world}%
This is a standalone PlaceholderAPI expansion. Do NOT put it into your plugins, but into the expansions
folder of PlaceholderAPI.
I'm currently waiting to get an account on the PlaceholderAPI site, so I can submit it as official ECloud extension.