All posts
tutorial
How to Build an AI Regex Generator with AI Pass SDK
Build an AI regex generator with AI Pass SDK. Turn plain English into regex with explanations. Earn 50% commission.
EiliyaFebruary 27, 20261 min read
How to Build an AI Regex Generator with AI Pass SDK
Build a regex generator that developers will love — and earn 50% commission on every pattern they generate.
What You'll Build
A web tool where users describe patterns in plain English and get working regex with explanations.
Prerequisites
- Sign up at aipass.one
- Developer Dashboard → OAuth2 Clients → create client → copy Client ID
Step 1: SDK Setup
<!DOCTYPE html>
<html>
<head>
<title>AI Regex Generator</title>
<link href="https://aipass.one/aipass-ui.css" rel="stylesheet">
</head>
<body>
<script src="https://aipass.one/aipass-sdk.js"></script>
<script>
AiPass.initialize({
clientId: 'YOUR_CLIENT_ID',
requireLogin: true,
darkMode: true
});
</script>
</body>
</html>
Step 2: Interface
<div style="max-width: 700px; margin: 40px auto; padding: 20px;">
<h1>🔍 AI Regex Generator</h1>
<textarea id="description" placeholder="Describe what you want to match (e.g., 'email addresses ending in .edu')" rows="3" style="width:100%;"></textarea>
<select id="lang" style="width:100%; margin: 10px 0;">
<option value="JavaScript">JavaScript</option>
<option value="Python">Python</option>
<option value="Java">Java</option>
<option value="Go">Go</option>
<option value="PHP">PHP</option>
</select>
<button onclick="generate()" style="width:100%; padding:12px;">Generate Regex</button>
<pre id="result" style="margin-top: 20px; background: #1a1a2e; color: #eee; padding: 20px; border-radius: 8px; overflow-x: auto;"></pre>
</div>
Step 3: AI Logic
async function generate() {
const desc = document.getElementById('description').value;
const lang = document.getElementById('lang').value;
const resultEl = document.getElementById('result');
resultEl.textContent = 'Generating regex...';
try {
const r = await AiPass.generateCompletion({
model: 'gpt-5-mini',
temperature: 1,
max_tokens: 16000,
messages: [
{
role: 'system',
content: `You are a regex expert. Given a description, provide:\n1. The regex pattern (for ${lang})\n2. A breakdown explaining each part\n3. 3 examples that match\n4. 2 examples that don't match\nFormat clearly with headers.`
},
{ role: 'user', content: desc }
]
});
resultEl.textContent = r.choices[0].message.content;
} catch (err) {
resultEl.textContent = 'Error. Please try again.';
}
}
Always include temperature: 1 and max_tokens: 16000 in generateCompletion calls.
Step 4: Deploy
Option A — Self-host: GitHub Pages, Netlify, Vercel, or your own server.
Option B — AI Pass catalog: Publish on AI Pass. Use the </> button to get embed code.
Revenue
50% commission on every API call. No payment setup needed.
See it live: AI Regex Generator · SDK