Code · best for
Best AI model for Regex Writing (2026)
Crafting regular expressions that actually match what you intend. Ranked from 346 live models on the OpenRouter catalog, weighted for reasoning quality, low cost.
| # | Model | Score | In / 1M | Out / 1M | Context | |
|---|---|---|---|---|---|---|
| 1 | Auto Routeropenrouter/auto | 400120 | $-1000000.00 | $-1000000.00 | 2,000,000 | Try → |
| 2 | Pareto Code Routeropenrouter/pareto-code | 400112 | $-1000000.00 | $-1000000.00 | 200,000 | Try → |
| 3 | Body Builder (beta)openrouter/bodybuilder | 400112 | $-1000000.00 | $-1000000.00 | 128,000 | Try → |
| 4 | Google: Gemma 4 26B A4B (free)google/gemma-4-26b-a4b-it:free | 120 | Free | Free | 262,144 | Try → |
| 5 | Google: Gemma 4 31B (free)google/gemma-4-31b-it:free | 120 | Free | Free | 262,144 | Try → |
| 6 | Qwen: Qwen3.5-9Bqwen/qwen3.5-9b | 120 | $0.10 | $0.15 | 262,144 | Try → |
| 7 | Google: Gemma 4 26B A4B google/gemma-4-26b-a4b-it | 119 | $0.07 | $0.35 | 262,144 | Try → |
| 8 | Google: Gemma 4 31Bgoogle/gemma-4-31b-it | 119 | $0.13 | $0.38 | 262,144 | Try → |
| 9 | ByteDance Seed: Seed-2.0-Minibytedance-seed/seed-2.0-mini | 119 | $0.10 | $0.40 | 262,144 | Try → |
| 10 | Qwen: Qwen3.5-Flashqwen/qwen3.5-flash-02-23 | 119 | $0.07 | $0.26 | 1,000,000 | Try → |
| 11 | ByteDance Seed: Seed 1.6 Flashbytedance-seed/seed-1.6-flash | 119 | $0.07 | $0.30 | 262,144 | Try → |
| 12 | xAI: Grok 4.1 Fastx-ai/grok-4.1-fast | 119 | $0.20 | $0.50 | 2,000,000 | Try → |
| 13 | Google: Gemini 2.5 Flash Lite Preview 09-2025google/gemini-2.5-flash-lite-preview-09-2025 | 119 | $0.10 | $0.40 | 1,048,576 | Try → |
| 14 | xAI: Grok 4 Fastx-ai/grok-4-fast | 119 | $0.20 | $0.50 | 2,000,000 | Try → |
| 15 | OpenAI: GPT-5 Nanoopenai/gpt-5-nano | 119 | $0.05 | $0.40 | 400,000 | Try → |
How we ranked these
For Regex Writing, we weight models on reasoning quality, low cost. Higher means better. Scores combine OpenRouter's model metadata (context length, modality support, tool calling, structured output, reasoning capability) with public pricing. See full methodology →
Related tasks
Code
Best for SQL Generation
Writing correct, performant SQL from natural-language prompts.
Code
Best for Code Review
Spotting bugs, security issues, and style problems in pull requests.
Code
Best for Code Completion
Inline IDE-style autocomplete that has to feel instant.
Code
Best for Code Refactoring
Safely restructuring an existing codebase across many files.
Code
Best for Bug Fixing
Diagnosing root cause and producing a working patch.
Code
Best for Unit Test Generation
Generating thorough test suites for existing functions.