RegEx API

The RegEx API creates a regular expression based on the provided text.
Optionally, a link can be generated to test the RegEx on regex101.

Endpoint

GET
/api/regex

Parameters

ParametersTypeDescription
phrase
string
The text for which a regular expression should be generated.
includeTestLink
boolean
optional
If set to "true", a link will be returned to test the regex on regex101. The default value is "false".
useSimilarChars
boolean
optional
If set to "true", similar characters (e.g. a,4,@) will be considered when creating the regex. The default value is "false".

Response

regex: The generated regex pattern

regex101Url (optional): The link to test the regex on regex101

HTTP Status Codes

200 OK

The request was successful, and the regular expression was created.

400 Bad Request

The request was invalid. Check the provided "phrase" parameter.

500 Internal Server Error

An error occurred while generating the regular expression.

Usage

GET /api/regex?phrase=test&includeTestLink=true&useSimilarChars=true

Note: All syntax functions listed in the RegEx Generator (round brackets, alternative operator, character ranges, etc.) can also be used with this API.

Try API

Chatty API

The Chatty API generates a regular expression based on the provided text.
Returns a highlight command for Chatty.

Endpoint

GET
/api/chatty

Parameters

ParametersTypeDescription
phrase
string
The text for which a regular expression should be generated.
useSimilarChars
boolean
optional
If set to "false", similar characters will not be considered when creating the regex. The default value is "true".

Response

/add2 highlight config:any regi: The generated regex pattern

HTTP Status Codes

200 OK

The request was successful, and the regular expression was created.

400 Bad Request

The request was invalid. Check the provided "phrase" parameter.

500 Internal Server Error

An error occurred while generating the regular expression.

Usage

1. Add the following command in the Chatty settings under "Commands":
/regex $request(https://hxdes.de/api/chatty?phrase=$urlencode($(1-)))

Alternatively without similar characters:
/regex $request(https://hxdes.de/api/chatty?phrase=$urlencode($(1-))&useSimilarChars=false)

2. Enter the command "/regex phrase" in the chat to generate a RegEx for the phrase, or add the entry "Regex=/regex $$1" in the "Selected Text Context Menu". Then, highlight the desired word in the chat, right-click it, and select "Regex".

Note: All syntax functions listed in the RegEx Generator (round brackets, alternative operator, character ranges, etc.) can also be used with this API.

Try API

APIs | hxdes