features • Installation • Usage
⭐️ Please press the star! It greatly helps development! ⭐️
A powerful command-line tool that demystifies regular expressions using AI-powered explanations. Regexplain helps developers understand complex regex patterns by providing clear, human-readable breakdowns.
- AI-Powered Explanations: Uses Groq's AI to generate comprehensive regex explanations
- Secure API Key Management: Securely stores your Groq API key using system keychain
- Proxy Support: Works behind corporate proxies with configurable proxy settings
- Developer-Friendly: Built with TypeScript for reliability and type safety
- Zero Configuration: Works out of the box with intuitive CLI interface
- Cross-Platform: Compatible with Windows, macOS, and Linux
npm install -g regexplain
Or use without installation with npx:
npx regexplain <your-regex>
regexplain <regex-pattern>
# Explain a simple email regex
regexplain '^[\\w.+\\-]+@[a-z\\d\\-.]+\\.[a-z]+$'
# Explain a complex password validator
regexplain '^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$'
📖 Explanation:
Breakdown:
- ^ : Start of the string
- [\w.+\-]+ : Matches one or more word characters, dots, plus signs, or hyphens
- @ : Literal @ character
- [a-z\d\-.]+ : Matches one or more lowercase letters, digits, hyphens, or dots
- \. : Escaped dot character (literal .)
- [a-z]+ : Matches one or more lowercase letters
- $ : End of the string
Overall Purpose: This pattern validates email addresses with a relatively permissive approach, allowing various characters in the local part and standard domain format.
Example Matches:
- user.name+tag@example.com
- user-name@sub.domain.co
Non-Matches:
- user@.com (missing domain name)
- user@com (missing top-level domain)
Regexplain features a minimalist CLI design focused on simplicity:
regexplain <regex> Explain a regular expression
The tool automatically:
- Handles API key management securely
- Provides option for proxy configuration
- Shows loading indicators during AI processing
- Formats output for optimal terminal readability
On first run, Regexplain will prompt for your Groq API key and store it securely in your system's keychain. Alternatively, you can set it as an environment variable:
export GROQ_API_KEY=your_api_key_here
Regexplain supports HTTPS proxies through:
- Environment variables (
HTTPS_PROXY
orhttps_proxy
) - Interactive prompt during execution
- Frontend/Backend Developers: Understand regex patterns in codebases
- Data Scientists: Parse and understand data extraction patterns
- DevOps Engineers: Debug log parsing rules and patterns
- Students: Learn regular expressions through practical examples
- Technical Writers: Document complex regex patterns accurately
- Code Reviewers: Quickly understand regex logic during reviews
Contributions are welcome! Please read our Contributing Guidelines and Code of Conduct.
- Requires internet connection for AI explanations
- Dependent on Groq API availability
- Complex regex patterns may have longer processing times
Note: This tool is designed for educational and productivity purposes. Always test regex patterns thoroughly in your specific use case.
MIT License - see LICENSE for details.
For support and questions, please open an issue on GitHub or contact backendwithali@gmail.com
Built with ❤️ by Ali Nazari, for developers.