Page 1 of 1

RegEx searching for RETURN

Posted: 2007-05-18, 19:25 UTC
by StatusQuo
Hi!

The exercise:
I was trying to find files containing "[" at the line beginning of some ASCII files,
so I searched for files containing the RegEx "\n\[" - without success. The same RegEx works OK in my text editor.

The workarounds/alternatives:
- search for RegEx "^\[" (works)
- search for hexadecimal representation of the values ("0d 0a 5b"). (works)

Suggestion:
  • The RegEx-search in the find files function doesn't seem to find CR/LF with "\n" -
    maybe this can be added, if it's not hard to implement?
  • This is not mentioned in the help (a hint would be nice there, if this will not be added).

Posted: 2007-05-18, 20:04 UTC
by petermad
Just search for "\n\[" WITHOUT checking the regEx option.

Posted: 2007-05-18, 20:16 UTC
by StatusQuo
petermad wrote:Just search for "\n\[" WITHOUT checking the regEx option.
Almost: "\n[" (without the second backslash) does the job without RegEx.
Thanks for the hint.

Posted: 2007-05-18, 22:48 UTC
by petermad
2StatusQuo
without the second backslash
That was what I meant to write - sorry.


BTW - it also works for tabs: \t[

Posted: 2007-05-20, 09:02 UTC
by ghisler(Author)
I searched for files containing the RegEx "\n\[" - without success.
Sorry, this cannot work, because RegEx in Total Commander is limited to single lines - it cannot find multiple lines. Therefore a regex search string will never contain any line breaks. However, the beginning and end of a line can be found via ^ and $.

Posted: 2007-05-20, 10:44 UTC
by StatusQuo
However, the beginning and end of a line can be found via ^ and $.
This works fine, thanks.
Maybe this sentence can be added to the help, perhaps on a central position like the RegEx parameter description page
("Note: You can not use \n together in TC's RegEx search, but...").

Posted: 2007-05-20, 11:31 UTC
by Flint
StatusQuo wrote:Maybe this sentence can be added to the help
It's already mentioned:
The other modificators are not relevant for Total Commander, because the program only supports searching within one line.

Posted: 2007-05-21, 00:51 UTC
by StatusQuo
Flint wrote:It's already mentioned:
The other modificators are not relevant for Total Commander, because the program only supports searching within one line.
OK, I missed that line, thanks. But the hint with the alternative is not there yet.
But this is maybe not a problem anymore, too, since now one can find the answer here with corresponding search keywords... :)


(for future searches: newline, line break)

Posted: 2007-05-21, 12:05 UTC
by Flint
StatusQuo wrote:But the hint with the alternative is not there yet.
I'm not sure it is necessary. The ^ and $ metacharacters are well-described; it's an easy task to make appropriate conclusion. IMHO, of course.