shabados / presenter

Desktop app for presenting the Shabad OS Database on projectors, TVs, and live streams
https://shabados.com
MIT License
19 stars 15 forks source link

[Search] add alternate search modes and regex search #146

Open bhajneet opened 5 years ago

bhajneet commented 5 years ago

From regex tutorial:

Because we want to do more than simply search for literal pieces of text, we need to reserve certain characters for special use. In the regex flavors discussed in this tutorial, there are 12 characters with special meanings: the backslash \, the caret ^, the dollar sign $, the period or dot ., the vertical bar or pipe symbol |, the question mark ?, the asterisk or star *, the plus sign +, the opening parenthesis (, the closing parenthesis ), the opening square bracket [, and the opening curly brace {, These special characters are often called "metacharacters". Most of them are errors when used alone.

So to implement regex, one would have to avoid these chars for our alternate search modes: \^$.|?*+()[]{}. Note that \^|[] are used in gurmukhi ASCII (though [] are line endings). Need to see if it can be reconciled. (Perhaps only allow those chars in GUI keyboard? Or perhaps re-route these to a different keyboard character in our app that is non-standard to the font spec?).

Alternate search mode proposals:

Regex ideas:

If you have more ideas, please feel free to discuss.

Related Issues:

bhajneet commented 5 years ago

Note, if doing normal first letter anywhere search, hitting the spacebar should be adding a wild card character. That wild card character can be converted to a . char, similar to regex.

If we decide not to do regex, perhaps the _ or * characters would make more sense for wildcard conversion.