QuickSearch eXtended
Moderators: Hacker, petermad, Stefan2, white
It would be best if Christian sent all files every time, but if he doesn't, you can work around it by checking whether reg exp is correct. I believe that counting parentheses and checking for '\' at the end is enough.Samuel wrote:I would like it and it seems like no big deal.
Im working on RegEx right now. But I think I need support from Mr. Ghisler for that. Currently when you would filter out all files with another letter, this letter is not written to the filter.
This gives problems using regex.
You cant write for example: "\d" because no file would match "". So you have to paste this string to Quicksearch.
I know some C regex that can be compiled with wchar :Samuel wrote:Anyone knows a good Regex lib for C++?
If you want very simple stuff, you can use T-Rex see here ! i C++ wrapper is available.
Thomas Lackner's port (from Tcl 8.5a3) of Henry Spencer library here ! you can include it or compile a separate dll.
for full c++
For big stuff you can use PCRE (google search) or Boost regex++....
With regex, 2 options are very useful to have :
A) Ignorecase/ case sensitive !
B) greedy/ non greedy match
Last edited by nsp on 2009-05-30, 15:00 UTC, edited 1 time in total.
I can also recommend
http://www.codeproject.com/KB/library/deelx.aspx
which is easy to integrate and pure C++.
http://www.codeproject.com/KB/library/deelx.aspx
which is easy to integrate and pure C++.
#84251
I guess the best solution would be if TC could share it's library. This would make plugin amd extension development easier and also lead to a common regex syntax in TC.
2Samuel
Great work!
The back and forth converting is more troublesome.
2Samuel
Great work!
There is no need to fear Unicode stringscurrently the Unicode string is converted to normal string, because I know normal strings better.

The back and forth converting is more troublesome.
- Samuel
- Power Member
- Posts: 1930
- Joined: 2003-08-29, 15:44 UTC
- Location: Germany, Brandenburg an der Havel
- Contact:
I first tried boost, an now I am using the very tiny deelx. Thx for the recommendations.
Source is available in first post. Regex is hard. Till now I didnt get it to work. I dont know whats the reason. If I use it from outside the dll, it just works fine. but in it it just gives trouble.
Here is the code:
Can anyone find an error?
Source is available in first post. Regex is hard. Till now I didnt get it to work. I dont know whats the reason. If I use it from outside the dll, it just works fine. but in it it just gives trouble.
Here is the code:
Code: Select all
BOOL __stdcall MatchFileW(WCHAR* QSFilter,WCHAR* FileName)
{
// convert WCHAR* to wString
wstring wsQSFilter(QSFilter);
wstring wsFileName(FileName);
// convert to lowercase:
transform(wsQSFilter.begin(),wsQSFilter.end(),wsQSFilter.begin(),tolower);
transform(wsFileName.begin(),wsFileName.end(),wsFileName.begin(),tolower);
// remove asterisks "*" before and after the filter:
if(wsQSFilter.substr(0,1) ==L"*") wsQSFilter.erase(0,1);
if(wsQSFilter.substr(wsQSFilter.length()-1,1)==L"*") wsQSFilter.erase(wsQSFilter.length()-1,1);
// should a RegEx search be used?
if(wsQSFilter.substr(0,1)==L"?"){
wsQSFilter.erase(0,1); // remove ? and add ".*" before and after search text
wsQSFilter=L".*"+wsQSFilter+L".*";
// search with RegEx
static CRegexpT <wchar_t> regexp(wsQSFilter.c_str(),wsQSFilter.length(),IGNORECASE);
MatchResult result=regexp.Match(wsFileName.c_str());
if(result.IsMatched()) return 1;
else return 0;
}
...
- Samuel
- Power Member
- Posts: 1930
- Joined: 2003-08-29, 15:44 UTC
- Location: Germany, Brandenburg an der Havel
- Contact:
Thanks Mr. J. Your my hero. That did it. (copied it from a function.)
And an inconvenience by TC. You have to enable both checkboxes from Configuration -> Quick Search -> exact name match to use RegEx. Otherwise asterisks are added before dots. (not just at the start and end of an expression.)
2ghisler (Author):
Could you please give the two options separately to the function. Please make it possible to have the unchanged string in the function without workarounds.
New tcmatch version with RegEx in first post.
2m^2: didnt you write something about strings some seconds ago?
And an inconvenience by TC. You have to enable both checkboxes from Configuration -> Quick Search -> exact name match to use RegEx. Otherwise asterisks are added before dots. (not just at the start and end of an expression.)
2ghisler (Author):
Could you please give the two options separately to the function. Please make it possible to have the unchanged string in the function without workarounds.
New tcmatch version with RegEx in first post.
2m^2: didnt you write something about strings some seconds ago?
Some examples:
[face=courier]\d\d[/face] => Files that contain two consecutive digits.
[face=courier]^w.*d$[/face] => Files that start with "w" and end with "d".
[face=courier][^x]y[/face] => files that contain an "y" but not "xy".
Use Google to find some more
Just tried the plug-in and I saw a small problem:
You can not type [face=courier]^[[/face] to start an expression in a box bracket. I guess because it tries to match files with [face=courier][[/face] (or because it's an invalid expression) and does not let me continue to type. It would be good to filter a [face=courier][[/face] if it is the last character and does not have a \ before it, so you could still end an expression with [face=courier]\[[/face].
[face=courier]\d\d[/face] => Files that contain two consecutive digits.
[face=courier]^w.*d$[/face] => Files that start with "w" and end with "d".
[face=courier][^x]y[/face] => files that contain an "y" but not "xy".
Use Google to find some more

Just tried the plug-in and I saw a small problem:
You can not type [face=courier]^[[/face] to start an expression in a box bracket. I guess because it tries to match files with [face=courier][[/face] (or because it's an invalid expression) and does not let me continue to type. It would be good to filter a [face=courier][[/face] if it is the last character and does not have a \ before it, so you could still end an expression with [face=courier]\[[/face].
I have several comments:
-Ini would be really useful. To enable reg exps by default, without '?'
-Sources. Can you change paths to relative ones?
-Bug: In reg exp mode, it doesn't accept space to make multiple searches. Example: "?h " in the main TC directory.
And a Ghisler's thing: inability to use arrows is REALLY annoying. I'm used to first write both parentheses, move cursor left and add content. I hate the current behaviour, I'd much much more welcome forcing me to dismiss the quick search dialog to be able to move the cursor horizontally than what is now.
-Ini would be really useful. To enable reg exps by default, without '?'
-Sources. Can you change paths to relative ones?
-Bug: In reg exp mode, it doesn't accept space to make multiple searches. Example: "?h " in the main TC directory.
And a Ghisler's thing: inability to use arrows is REALLY annoying. I'm used to first write both parentheses, move cursor left and add content. I hate the current behaviour, I'd much much more welcome forcing me to dismiss the quick search dialog to be able to move the cursor horizontally than what is now.
