Developer🌐 YAS server-sideAPI availablebeginner
Regex Escaper
Escapes a literal string so it is treated as plain text inside a regular expression.
Processed by YAS · not stored
Ready to runInstant execution
Loading tool…
What does this tool do?
Escapes a literal string so it is treated as plain text inside a regular expression.
Why would I use it?
- You want to search for a literal dot, slash or dollar in text.
- You are building a regex from user input safely.
- You keep getting matches you did not expect from metacharacters.
Real-life example
Input
a.b*c
Output
a\.b\*c
Metacharacters are escaped so they match literally.
Input → Process → Output → Next
- Input
- Type the literal text.
- Process
- YAS escapes regex metacharacters.
- Output
- A regex-safe version of your string.
- Next action
- Use it inside your regex with no further escaping.
Common mistakes
- Escaping already-escaped text (double escaping).
- Not escaping in character classes.
- Using the result as a full pattern when you only wanted a fragment.
What the result means
The escaped string matches the original text literally inside a regex.
Privacy & security
Your input is sent to YAS infrastructure because the tool requires server-side processing or public network queries. Input is not stored.
API
Endpoint
POST https://yas.sh/api/v1/tools/regex-escaper
Request Header
Content-Type: application/json
cURL
curl -X POST "https://yas.sh/api/v1/tools/regex-escaper" \
-H "Content-Type: application/json" \
-d '{"input":"a.b*c"}'JavaScript
const res = await fetch("https://yas.sh/api/v1/tools/regex-escaper", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"input": "a.b*c"
}),
});
const data = await res.json();Python
import requests
r = requests.post("https://yas.sh/api/v1/tools/regex-escaper", json={"input":"a.b*c"})
data = r.json()| Field | Type | Required | Description |
|---|---|---|---|
| input | string | Yes | Text to escape |
Success response
{ "escaped": "a\.b\*c", "original": "a.b*c" }Escape a literal string to be regex-safe.
Error responses
400 VALIDATION_ERROR— invalid input or unsupported option.413 PAYLOAD_TOO_LARGE— input exceeds the 64 KB limit.429 RATE_LIMIT_EXCEEDED— rate limit exceeded (60 req/min).
Limits
- Maximum input: 64 KB per request.
- Rate limit: 60 requests/min per IP address.
- Authenticated accounts benefit from higher tier quotas.
Related tools