Lightning-fast regex meets AI-powered semantic search
Find exact patterns and contextually relevant matches with intelligent history tracking and REST API integration.
| Feature | Description |
|---|---|
| 🔄 Dual-Mode Search | Regex pattern matching along with AI-powered semantic search |
| 🧠 Semantic Intelligence | Understands context, finds synonyms, and avoids antonyms |
| 📜 History Tracking | Maintains searchable history in SQLite with JSON export |
| 🔌 REST API | Full programmatic access via clean JSON endpoints |
| 🌐 Web Interface | Responsive UI for quick searches and file uploads |
| ⚡ Optimized Performance | Efficient line scanning with intelligent caching |
-
Regex Usage: Shows a complex Regex pattern matching date/time data in a log snippet.
-
Semantic Search Usage: Shows a Semantic search for "happy" returning "proud" with a similarity score.
-
Server Log: The server terminal output showing multiple successful POST /semantic calls.
-
History: The history table view, displaying matches, pattern, and timestamp columns.
-
Postman Output: Shows the Postman interface with the JSON history response from the /search endpoint.
# Clone the repository
git clone https://github.com/yourusername/deepgrep.git
cd deepgrep
# Install dependencies
pip install -r requirements.txt# Start the API server
python3 -m deepgrep.web.appThe web interface will be available at http://localhost:8000
Endpoint: POST /search
Request:
{
"pattern": "\\d+",
"text": "User logged in at 14:32, error code 404"
}Response:
{
"matches": ["14", "32", "404"],
"history": [
{
"pattern": "\\d+",
"timestamp": "2025-10-26T16:00:00",
"matches_count": 3
}
]
}Endpoint: POST /semantic
Request:
{
"keyword": "happy",
"text": "She felt joyful and delighted after the announcement"
}Response:
{
"matches": [
{"word": "joyful", "similarity": 0.88},
{"word": "delighted", "similarity": 0.82}
],
"history": [
{
"keyword": "happy",
"timestamp": "2025-10-26T16:05:00",
"matches_count": 2
}
]
}- Open http://localhost:8000 in your browser
- Choose search mode: Regex or Semantic
- Enter your pattern/keyword and text (or upload a file)
- Click Search
- View results and search history in real-time
┌──────────────────────────┐
│ Web Frontend │
│ (HTML + Tailwind + JS) │
│ │
│ • Input: Pattern/Keyword│
│ • Output: │
│ - Search Results │
│ - Search History │
└─────────────┬────────────┘
│
│ HTTP/REST (JSON)
▼
┌──────────────────────────┐
│ Flask API │
│ (Endpoints: /search, │
│ /semantic) │
│ • Routes requests to │
│ Regex or Semantic │
│ Engine │
│ • Logs history │
└─────────────┬────────────┘
│
┌────────────────┴─────────────────┐
│ │
▼ ▼
┌─────────────────────┐ ┌─────────────────────┐
│ Regex Engine │ │ Semantic Engine │
│ (Pattern Matching) │ │ (SpaCy + WordNet) │
│ • Fast regex search│ │ • Contextual match │
│ • Backrefs, groups │ │ • Avoid antonyms │
└─────────────┬───────┘ └─────────────┬───────┘
│ │
└──────────────┬────────────────────┘
▼
┌──────────────────┐
│ Search History │
│ (SQLite DB) │
│ • Logs patterns │
│ • Match counts │
│ • Files/context │
└──────────────────┘
- Frontend: Displays search results and history with a responsive interface
- API Layer: Single gateway routing to both search engines
- Regex Engine: Fast exact pattern matching with support for groups and backreferences
- Semantic Engine: AI-powered contextual matching using spaCy and WordNet
- History Database: Persistent SQLite storage with full search history
This project is licensed under the MIT License - see the LICENSE file for details.