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

/api/regex

Method

GET

Parameters

phrase: string (required)

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.

Chatty API

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

Endpoint

/api/chatty

Method

GET

Parameters

phrase: string (required)

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. Use the command /regex phrase in the chat to generate a regex for the phrase. Note: All syntax functions listed in the RegEx Generator (round brackets, alternative operator, character ranges, etc.) can also be used with this API.