-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
global search accepts regex #169
Labels
subtask
dependent on another open issue
Comments
Could be a subtask of #73 When the v8 of react-table will be available, we need to improve the search input yep :) |
you are right. had not seen that feature. anyway awesome work with your extension. |
RafaelGB
added
wontfix
This will not be worked on
and removed
wontfix
This will not be worked on
labels
Sep 11, 2022
The idea will be support regex import { FilterFn, Row } from "@tanstack/react-table"
import { RowDataType } from "cdm/FolderModel"
import { LocalSettings } from "cdm/SettingsModel";
import { InputType } from "helpers/Constants";
import { Literal } from "obsidian-dataview";
import { DataviewService } from "services/DataviewService";
export const globalDatabaseFilterFn: (ddbbConfig: LocalSettings) => FilterFn<RowDataType> = (ddbbConfig: LocalSettings) => (
row: Row<RowDataType>,
columnId: string,
filterValue: string
) => {
const value = row.getValue<Literal>(columnId);
if (value === undefined) {
return false;
}
const sanitized = DataviewService.parseLiteral(value, InputType.MARKDOWN, ddbbConfig, true).toString().toLowerCase();
filterValue = filterValue.toLowerCase();
return sanitized.includes(filterValue) || searchRegex(sanitized, filterValue);
}
function searchRegex(sanitized: string, filterValue: string): boolean {
try {
const regex = new RegExp(filterValue);
return regex.test(sanitized);
} catch (e) {
return false;
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the solution you'd like
often i want to exclude something from the search or see everything except ....
ideas
The text was updated successfully, but these errors were encountered: