Your First Request

This section will guide you on how to perform your first call to the RegexSolver API. To use the following steps, you need to have already obtained a valid API token. You will use this token to authenticate your API requests.

Example Use Case: Analyzing a Regex Pattern

In this example, we will analyze the regex pattern [A-Z][a-z]{1,4}.

curl -X POST "https://api.regexsolver.com/api/analyze/details" \
    -H "Authorization: Bearer $REGEX_SOLVER_API_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"type":"regex","value":"[A-Z][a-z]{1,4}"}'

By setting up an environment variable called $REGEX_SOLVER_API_TOKEN containing your API token you can call the above cURL command to get the details of the regex pattern [A-Z][a-z]{1,4}.

If your API token is valid and correctly set up, the command should return the following JSON structure:

{
  "type": "details",
  "cardinality": {
    "type": "Integer",
    "value": 12356604
  },
  "length": [
    2,
    5
  ],
  "empty": false,
  "total": false
}