> For the complete documentation index, see [llms.txt](https://alexandria.enhe.social/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alexandria.enhe.social/features/regex-search.md).

# Regex Search

Regex Search, introduced in v1.5, is a power-user feature that lets you use regular expressions as search patterns across all search views in Alexandria: **Omni-Search**, **Search Bookmarks**, and **Search History**.

## Enabling regex mode

Each search view has a small toggle button next to the search input. Click it to switch between normal and regex mode. In regex mode:

* The input border changes color as a visual cue.
* The placeholder text updates to `/pattern/flags` to hint at the expected syntax.

## Writing patterns

Standard JavaScript regex syntax is supported. A few examples:

| Pattern          | What it matches                                  |
| ---------------- | ------------------------------------------------ |
| `github.*issues` | Any URL containing "github" followed by "issues" |
| `/react/i`       | Case-insensitive match for "react"               |
| `^https://news`  | URLs that start with `https://news`              |

Since the Chrome browser APIs don't support regex natively, Alexandria fetches a larger result set (up to 200–500 items) and filters it client-side using JavaScript's `RegExp`.

## Invalid patterns

If you type an invalid regex, Alexandria displays a subtle red **"Invalid regex pattern"** hint below the input instead of crashing. No results will be shown until the pattern is corrected.

## Persisting state

The regex toggle state persists within a session. If you enable it in Omni-Search and navigate to Search History and back, it will remember your preference.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alexandria.enhe.social/features/regex-search.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
