This forum uses cookies. Click X button to hide this message. What is stored? 
Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

QuickSearch eXtended
Goto page Previous  1, 2, 3, ... 46, 47, 48  Next
 
Post new topic   Reply to topic    Total Commander Forum Index -> Plugins and addons: devel.+support (English) Printable version
View previous topic :: View next topic  
Author Message
Boofo
Power Member
Power Member


Joined: 10 Feb 2003
Posts: 1431
Location: Des Moines, IA (USA)

PostPosted: Sat May 30, 2009 6:05 am    Post subject: Reply with quote

Maybe there could be a check box in the regular search that would enable this. That way you could disable it for regex.
_________________
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
m^2
Power Member
Power Member


Joined: 12 Jul 2006
Posts: 1413
Location: Poland

PostPosted: Sat May 30, 2009 6:26 am    Post subject: Reply with quote

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.

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.
_________________
Image: http://img201.imageshack.us/img201/2110/pcbsdec7.jpg
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
nsp
Power Member
Power Member


Joined: 04 Dec 2005
Posts: 1129
Location: Lyon (FRANCE)

PostPosted: Sat May 30, 2009 8:29 am    Post subject: Reply with quote

Samuel wrote:
Anyone knows a good Regex lib for C++?


I know some C regex that can be compiled with wchar :
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 Sat May 30, 2009 9:00 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
j
Member
Member


Joined: 13 Apr 2009
Posts: 123

PostPosted: Sat May 30, 2009 8:36 am    Post subject: Reply with quote

I can also recommend

http://www.codeproject.com/KB/library/deelx.aspx

which is easy to integrate and pure C++.
_________________
#84251
Back to top
View user's profile Send private message
Lefteous
Power Member
Power Member


Joined: 08 Feb 2003
Posts: 9386
Location: Germany

PostPosted: Sat May 30, 2009 9:07 am    Post subject: Reply with quote

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!
Quote:
currently the Unicode string is converted to normal string, because I know normal strings better.

There is no need to fear Unicode strings Smile
The back and forth converting is more troublesome.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Samuel
Power Member
Power Member


Joined: 29 Aug 2003
Posts: 1837
Location: Brandenburg, Germany

PostPosted: Sat May 30, 2009 5:08 pm    Post subject: Reply with quote

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:
Code:
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;
 }

...


Can anyone find an error?
_________________
QuickSearch eXtended | ButtonBar eXtended | www.familie-plentz.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
j
Member
Member


Joined: 13 Apr 2009
Posts: 123

PostPosted: Sat May 30, 2009 8:04 pm    Post subject: Reply with quote

The static in front of CRegexpT does not look like a good idea to me. Remove it and you should be fine...
Back to top
View user's profile Send private message
Samuel
Power Member
Power Member


Joined: 29 Aug 2003
Posts: 1837
Location: Brandenburg, Germany

PostPosted: Sun May 31, 2009 2:06 am    Post subject: Reply with quote

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?
_________________
QuickSearch eXtended | ButtonBar eXtended | www.familie-plentz.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
m^2
Power Member
Power Member


Joined: 12 Jul 2006
Posts: 1413
Location: Poland

PostPosted: Sun May 31, 2009 2:19 am    Post subject: Reply with quote

Samuel wrote:
2m^2: didnt you write something about strings some seconds ago?

I did. But I got up just before this and missed important part of your code. My post made no sense here, so I deleted it.
_________________
Image: http://img201.imageshack.us/img201/2110/pcbsdec7.jpg
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Boofo
Power Member
Power Member


Joined: 10 Feb 2003
Posts: 1431
Location: Des Moines, IA (USA)

PostPosted: Sun May 31, 2009 3:39 am    Post subject: Reply with quote

Can someone post a good example of using RegEx with this? I have not dealt with RegEx before.
_________________
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
j
Member
Member


Joined: 13 Apr 2009
Posts: 123

PostPosted: Sun May 31, 2009 4:23 am    Post subject: Reply with quote

Some examples:
\d\d => Files that contain two consecutive digits.
^w.*d$ => Files that start with "w" and end with "d".
[^x]y => files that contain an "y" but not "xy".

Use Google to find some more Smile

Just tried the plug-in and I saw a small problem:
You can not type ^[ to start an expression in a box bracket. I guess because it tries to match files with [ (or because it's an invalid expression) and does not let me continue to type. It would be good to filter a [ if it is the last character and does not have a \ before it, so you could still end an expression with \[.
Back to top
View user's profile Send private message
Boofo
Power Member
Power Member


Joined: 10 Feb 2003
Posts: 1431
Location: Des Moines, IA (USA)

PostPosted: Sun May 31, 2009 4:31 am    Post subject: Reply with quote

Those only work in the regular search, right?
_________________
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
j
Member
Member


Joined: 13 Apr 2009
Posts: 123

PostPosted: Sun May 31, 2009 4:34 am    Post subject: Reply with quote

You have to start your search with a ? in order to use regular expressions with Samuels plug-in. So ?\d\d for example.
Back to top
View user's profile Send private message
Boofo
Power Member
Power Member


Joined: 10 Feb 2003
Posts: 1431
Location: Des Moines, IA (USA)

PostPosted: Sun May 31, 2009 4:38 am    Post subject: Reply with quote

Thank you for that. I was expecting to get nailed on that one. Wink

I take it that is a known thing?
_________________
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
m^2
Power Member
Power Member


Joined: 12 Jul 2006
Posts: 1413
Location: Poland

PostPosted: Sun May 31, 2009 5:11 am    Post subject: Reply with quote

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. Rolling Eyes
_________________
Image: http://img201.imageshack.us/img201/2110/pcbsdec7.jpg
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Plugins and addons: devel.+support (English) All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, ... 46, 47, 48  Next
Page 2 of 48

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Impressum: This site is maintained by Ghisler Software GmbH

Using phpBB © 2001-2005 phpBB Group