This is the API RegexPlanet uses to communicate with the different backend regex engines. This is only
useful for someone who wants to contribute a new backend.
The backends are pretty simple. They are just single-page websites that returns a JSON/JSONP response with the HTML results.
You can see the source for some of the existing backends on GitHub:
You can find useful snippets of code to help get started at Rosetta Code.
I need the following data to support an engine on RegexPlanet:
- Name of the language or engine
- Description: library or module name
- An image: PNG format, approximately 100 px wide by 40 px tall for the Regex Engine List page.
- An image: PNG format, exactly 94px tall for the home page.
- A name and url for the syntax reference page. This will be displayed in the blue pill on the top right of the test page.
- A list of (name, url) for other help links. These will be displayed on the main support page under “Official Documentation”
- A list of which options it supports. Please use the common (long) codes so options can be shared between engines.
Input
All the parameters from the test page.
- callback - the name of the JSONP callback function. This is the only parameter not visible in the page source. This will not be present for browsers (*cough* MSIE *cough*) that do not support CORS. They get get proxied instead.
- regex - the regular expression
- option - options that are set (can be multiple, see the current list)
- replacement - replacement string.
- input - text to test against (can be multiple)
Note that multiple parameters do
not have any special suffixes (i.e.
[0]
or whatever). Web frameworks will just have to deal.
Hopefully I'll keep this list up to date, but you can always look at the page source to see what's there.
Output
JSONP (if
callback
parameter exists) or JSON containing the following:
- success - boolean, true only if no errors
- html - html to display on the page
Input
(none)
Output
JSON map of any items of interest. Mandatory items:
- success - boolean, true only if no errors
- version - String, human-readable version information
- favicon.ico
- robots.txt
- humans.txt (if you want to take some credit)
- (default page) - should redirect to the advanced test page on www.regexplanet.com
- recent.json - recently tested regexs
You can try your engine by adding a testurl
parameter to the query string of the advanced test page. I.e. something like:
https://www.regexplanet.com/advanced/perl/index.html?testurl=http://localhost:8080/status.json