{"uid":"cap_fi56FwrzddXmTI_wkEvne","slug":"fastx402-regex-escape-8e91b77a","name":"FastX402 Regex Escape","description":"200 pay-per-call tools for AI agents, from $0.001 per request in USDC on Base or Solana with x402. No account, no API key.","url":"https://fastx402.tools/regex-escape?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["text"],"properties":{"text":{"type":"string","description":"Literal text to escape (max 2000 characters)"},"flavor":{"type":"string","description":"Target regex flavor: javascript (default), python, or pcre"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"text":{"type":"string"},"flavor":{"type":"string"},"escaped":{"type":"string"},"pattern":{"type":"string"}}}}}}},"responseSchema":{"type":"json","example":{"text":"a.b*c+","flavor":"javascript","escaped":"a\\.b\\*c\\+","pattern":"/^a\\.b\\*c\\+$/"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ebcBhil7EAolhgV8Hs9pw","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Escapes a literal text string for safe use in a regex pattern, returning both the escaped string and a ready-to-use anchored pattern for JavaScript, Python, or PCRE flavors.","exampleAgentPrompt":"Escape the text 'a.b*c+' so I can use it safely as a literal match in a JavaScript regex — give me the escaped string and the full pattern.","exampleUseCases":[{"title":"Escape user input for regex search","prompt":"I have a search string from a user: 'file.name (v2)+' — can you escape it so I can plug it directly into a JavaScript regex without any special characters breaking the match?"},{"title":"Generate Python regex pattern from URL","prompt":"I need to match the literal URL 'https://example.com/path?q=1&page=2' in a Python regex — escape it properly and give me the pattern I can use."},{"title":"Sanitize file path for PCRE pattern","prompt":"Escape this Windows file path 'C:\\Users\\john\\report (final).docx' for use in a PCRE regex and show me the ready-to-use anchored pattern."}],"resultDescription":"A JSON object containing the original text, the regex flavor used, the escaped version of the string with all metacharacters properly backslashed, and a complete anchored regex pattern string (e.g. /^escaped_text$/ for JavaScript) ready to paste into code.","failureModes":["Missing required 'text' query parameter returns an error","Text exceeding 2000 characters is rejected","Invalid flavor value (anything other than javascript, python, or pcre) may return an error or default to javascript","Payment failure via x402 protocol results in 402 response before processing"],"whenToPreferThis":"Use this endpoint when you need to safely embed arbitrary user-supplied or dynamic text inside a regex pattern without manually tracking which characters need escaping. It is especially useful when the target regex flavor matters (JavaScript vs Python vs PCRE), since escaping rules differ subtly. Prefer this over writing your own escaping logic when correctness and flavor-specificity are important.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-18T12:56:24.463Z","isFirstParty":false,"canonicalSlug":"fastx402-regex-escape-8e91b77a"}