Skip to content

Commit 14c209b

Browse files
committed
fix(search): clarify invalid regex hint
1 parent 819e308 commit 14c209b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/code_index_mcp/utils/validation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ def validate_search_pattern(pattern: str, regex: bool = False) -> Optional[str]:
142142
try:
143143
re.compile(pattern)
144144
except re.error as e:
145-
return f"Invalid regex pattern: {str(e)}"
145+
return (
146+
f"Invalid regex pattern: {str(e)}. "
147+
"If you intended a literal search, pass regex=False."
148+
)
146149

147150
# Check for potentially expensive regex patterns (basic ReDoS protection)
148151
dangerous_patterns = [

0 commit comments

Comments
 (0)