Easy-to-use placeholder library to focus on replacement of regular expressions inside a text.

Overview

WPlaceholder

Flexible library to replace placeholders inside messages/texts with Regex expressions.

For what it's good for

Placeholder replacement is a common task in many languages. This library is a flexible and easy to use solution to replace texts/messages with new messages.

Besides replacing placeholders

To understand how does it works, let's look at an example:

public static void main(String[]args){
    String message = "Hello {name}, how are you?";
    String name = "John";
    String replacedMessage = message.replaceAll("\\{name\\}", name);
    System.out.println(replacedMessage);
}

It will print: Hello John, how are you?

The \\{name\\} is a placeholder. It's a special character that is used to replace a value. That essentially means that the \\{name\\} will be replaced with the value of the name variable.

Applying WPlaceholder

There are few ways to add WPlaceholder in your project like:

Gradle DSL:

repositories() {
    maven {
        name = "jitpack"
        url = 'https://jitpack.io'
    }
}   

dependencies() {
    implementation 'com.github.luiz-otavio.wisply-placeholder:common:{PROJECT_VERSION}'
}

Kotlin DSL:

repositories() {
    maven("https://jitpack.io")
}

dependencies() {
    implementation("com.github.luiz-otavio.wisply-placeholder:common:{PROJECT_VERSION}")
}

Maven:

<repositories>
    <repository>
        <id>jitpack</id>
        <name>jitpack</name>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.luiz-otavio.wisply-placeholder</groupId>
        <artifactId>common</artifactId>
        <version>{PROJECT_VERSION}</version>
    </dependency>
</dependencies>

How to use it

// Bukkit example:

public class Main {
    public static void main(String[] args) {
         PlaceholderDelegator.PlaceholderDelegator facade = PlaceholderDelegator.createDelegator('%');
         
         facade.register(new VariablePlaceholder("%name%", "WizardBR_"));
         
         System.out.println(
           PlaceholderDelegator.replace("Hello %name%!")
         );
    }
}

It will be: Hello WizardBR_!

You might also like...

reload4j is a drop-in replacement for log4j 1.2.17

What is reload4j? The reload4j project is a fork of Apache log4j version 1.2.17. It aims to fix the most urgent issues in log4j 1.2.17 which hasn't se

Dec 15, 2022

JSON Library for Java with a focus on providing a clean DSL

JSON Library for Java with a focus on providing a clean DSL

Jul 11, 2022

Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform.

twitter-text This repository is a collection of libraries and conformance tests to standardize parsing of Tweet text. It synchronizes development, tes

Jan 8, 2023

Open source Picture to text, text to Picture app

Open source Picture to text, text to Picture app

Pic SMS App Pic SMS is a free open source app. With Pic SMS, you can: convert pictures into text parts and send as SMS convert text parts into a pictu

Feb 8, 2022

Extract text from a PDF (pdf to text). Api for PHP/JS/Python and others.

Extract text from a PDF (pdf to text). API in docker. Why did we create this project? In the Laravel project, it was necessary to extract texts from l

May 13, 2022

Text Object Java Objects (TOJOs): an object representation of a multi-line structured text file like CSV

It's a simple manager of "records" in a text file of CSV, JSON, etc. format. It's something you would use when you don't want to run a full database,

Dec 27, 2022

Facsimile - Copy Your Most Used Text to Clipboard Easily with Facsimile!. It Helps You to Store You Most Used Text as a Key, Value Pair and Copy it to Clipboard with a Shortcut.

Facsimile - Copy Your Most Used Text to Clipboard Easily with Facsimile!. It Helps You to Store You Most Used Text as a Key, Value Pair and Copy it to Clipboard with a Shortcut.

Facsimile An exact copy of Your Information ! Report Bug · Request Feature Table of Contents About The Project Built With Getting Started Installation

Sep 12, 2022

RTL marquee text view android right to left moving text - persian - farsi - arabic - urdo

RTL marquee text view android right to left moving text - persian - farsi - arabic - urdo

RtlMarqueeView RTL marquee text view can hande the speed of moving text can jump to the specefic position of the text at start can loop the marquee te

Feb 14, 2022

A VisionCamera Frame Processor Plugin to preform text detection on images using MLKit Vision Text Recognition

A VisionCamera Frame Processor Plugin to preform text detection on images using MLKit Vision Text Recognition

vision-camera-ocr A VisionCamera Frame Processor Plugin to preform text detection on images using MLKit Vision Text Recognition. Installation yarn add

Dec 19, 2022

Annotation processor to create immutable objects and builders. Feels like Guava's immutable collections but for regular value objects. JSON, Jackson, Gson, JAX-RS integrations included

Read full documentation at http://immutables.org // Define abstract value type using interface, abstract class or annotation @Value.Immutable public i

Dec 31, 2022

Backport of Java 8's lambda expressions to Java 7, 6 and 5

Backport of Java 8's lambda expressions to Java 7, 6 and 5

Retrolambda: Use Lambdas on Java 7 Just as there was Retroweaver et al. for running Java 5 code with generics on Java 1.4, Retrolambda lets you run Ja

Dec 30, 2022

An efficient and flexible token-based regular expression language and engine.

OpenRegex OpenRegex is written by Michael Schmitz at the Turing Center http://turing.cs.washington.edu/. It is licensed under the lesser GPL. Please s

Jul 12, 2022

ReDoSHunter: A Combined Static and Dynamic Approach for Regular Expression DoS Detection

ReDoSHunter ReDoSHunter is a combined static and dynamic approach for regular expression DoS detection. LATEST NOTE (updated at 2021.09.13): ReDoSHunt

Dec 23, 2022

MathParser - a simple but powerful open-source math tool that parses and evaluates algebraic expressions written in pure java

MathParser - a simple but powerful open-source math tool that parses and evaluates algebraic expressions written in pure java

MathParser is a simple but powerful open-source math tool that parses and evaluates algebraic expressions written in pure java. This projec

Dec 24, 2022

A plugin of Grasscutter for send regular notice.

MeaNotice - Grasscutter Regular Notice Plugin MeaNotice is a plugin of Grasscutter, you can use this plugin to publish notifications in-game regularly

Oct 17, 2022

EvalEx is a handy expression evaluator for Java, that allows to evaluate expressions.

EvalEx - Java Expression Evaluator EvalEx is a handy expression evaluator for Java, that allows to parse and evaluate expression strings. Key Features

Sep 18, 2022
Owner
Luiz Otávio
15y | Technology enthusiast
Luiz Otávio
Java regular expressions made easy.

JavaVerbalExpressions VerbalExpressions is a Java library that helps to construct difficult regular expressions. Getting Started Maven Dependency: <de

null 2.6k Dec 30, 2022
Human friendly alternative to Regular Expressions

Cucumber Expressions Cucumber Expressions is an alternative to Regular Expressions with a more intuitive syntax. Try Cucumber Expressions in your brow

Cucumber 86 Jan 8, 2023
A free, simple-to-use drop-in replacement to DeluxeChat for HEX supported chat.

ChitChat A lightweight, simple-to-use chat plugin for Spigot and Paper Minecraft Servers - that supports 1.16+ hex-based styling, tooltips, click comm

Charlie Joseph 4 Dec 11, 2022
JCLR (JavaColor) is a library that allows you to write colored text in your terminal. It use the ANSI color system. Go check the README.md file to see how to use it.

JCLR JCLR (JavaColor) is a library that allows you to write colored text in your terminal. It use the ANSI color system. To start using it, go to the

Scythe 3 Aug 21, 2021
QuickShell is an Eclipse plugin to use Java JShell inside the Eclipse IDE.

QuickShell is an Eclipse plugin to use Java JShell (REPL) inside Eclipse IDE. JDK 9+ is not installed on your system? No worries, you can still use Qu

Nilesh Khaire 8 Oct 3, 2022
Easy-es - easy use for elastich search

Born To Simplify Development What is Easy-Es? Easy-Es is a powerfully enhanced toolkit of RestHighLevelClient for simplify development. This toolkit p

null 777 Jan 6, 2023
A distributed lock that supports the use of Redis and Zookeeper, out of the box, fast and easy to use

lock-spring-boot-starter A distributed lock that supports the use of Redis and Zookeeper, out of the box, fast and easy to use 一款基于 Redis 和 Zookeeper

Pear Stack 9 Oct 15, 2022
Realm is a mobile database: a replacement for SQLite & ORMs

Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for the Java version of Realm

Realm 11.4k Jan 5, 2023
Joda-Time is the widely used replacement for the Java date and time classes prior to Java SE 8.

Joda-Time Joda-Time provides a quality replacement for the Java date and time classes. The design allows for multiple calendar systems, while still pr

Joda.org 4.9k Dec 27, 2022
FST: fast java serialization drop in-replacement

fast-serialization up to 10 times faster 100% JDK Serialization compatible drop-in replacement (Ok, might be 99% ..). As an example: Lambda Serializat

moru0011 1.5k Dec 15, 2022