FarEng.patch (9,256 bytes)
Index: FarEng.hlf.m4
===================================================================
--- FarEng.hlf.m4 (revision 3430)
+++ FarEng.hlf.m4 (working copy)
@@ -2464,7 +2464,7 @@
According to ~editor settings~@EditorSettings@, newly created file
is assigned to OEM or ANSI codepage. You can change the codepage with #Shift-F8#.
- For existing file, changing the codepage has sense if it hasn't been
+ For existing file, changing the codepage has sense if it hasn't been
correctly detected at open.
@@ -3242,6 +3242,13 @@
characters (a comma or a semicolon), so that the mask doesn't get confused with
a list.
+ File mask surrounded with slashes #/# is treated as ~Perl regular expression~@RegExp@.
+
+ Example:
+ #/(eng|rus)/i# any files with filename containing string “eng” or “rus”,
+ the character case is not taken into account.
+
+
In some commands (~find files~@FindFile@, ~filter~@Filter@,
~filters menu~@FiltersMenu@, file ~selection~@SelectFiles@,
file ~associations~@FileAssoc@ and
@@ -3263,6 +3270,9 @@
more than once.
5. |*.bak
The same as *|*.bak
+ 6. *.*|/\d{1,3}\.gif$/i
+ All files except for those with filenames ending with 1 to 3 digits and
+ string “.gif”, disregard the character case.
The comma (or semicolon) is used for separating file masks from each other,
and the '|' character separates include masks from exclude masks.
@@ -3684,8 +3694,166 @@
@RegExp
$ #Regular expressions#
+ The regular expressions syntax is almost equal to those from Perl.
+ General form: #regexp# or /#regexp#/#options#.
+ #Options#:
+ #i# - ignore character case;
+ #s# - ^<wrap>consider the whole text as one line, '.' matches any character;
+ #m# - ^<wrap>consider the whole text as multiple lines. ^ и $ match the
+ beginning and the end of any "inner" string;
+ #x# - ^<wrap>ignore space characters (unscreened ones, i.e. without backslash before).
+This is useful to outline the complex expressions.
+
+ #regexp# - the sequence of characters and metacharacters. The characters are
+letters and digits, any other symbol becomes character when screened, i.e.
+prepended the backslash #\#.
+
+ Pay attention that all slashes and backslashes in regular expression must
+be prepended with the symbol #\# to differ from other special symbols or with
+the end of expression. An example: the string "big\white/scary" looks in the
+form of regular expression like "big\\white\/scary".
+
+ #Metacharacters#
+
+ #\# - ^<wrap>the next symbol is treated as itself, not a metacharacter
+ #^# - ^<wrap>the beginning of string
+ #$# - ^<wrap>the end of string
+ #|# - ^<wrap>the alternative. Either expression before or after #|# has to match.
+
+ ^<wrap>An example: "\d+\w+|Hello\d+" means "(\d+\w+)|(Hello\d+)", not "\d+(\w+|H)ello\d+".
+
+ #()# - ^<wrap>grouping - it is used for references or when replacing matched text.
+ #[]# - ^<wrap>character class - the metacharacter which matches any symbol
+or range of symbols enumerated in #[]#. Ranges are defined as [a-z].
+Metacharacters are not taken into account in character classes. If the first
+symbol in class is #^# then this is a negative class. If the character #^# has
+to be added to class, then it either must not to be at first place or it must
+be prepended with #\#.
+
+ Except grouping, the parentheses are used for the following operations:
+ #(?:pattern)# - ^<wrap>usual grouping, but it does not get a number.
+ #(?=pattern)# - ^<wrap>the forward lookup. The matching continues from
+the same place, but only if the pattern in these parentheses has matched. For
+example, #\w+(?=\s)# matches the word followed by space symbol, and the space
+is not included into the search result.
+ #(?!pattern)# - ^<wrap>the negation of forward lookup. The matching
+continues from the same place if the pattern does not match. For example,
+#foo(?!bar)# matches any "foo" without following "bar". Remember that this
+expression has zero size, which means that #a(?!b)d# matches #ad# because #a#
+is followed by the symbol, which is not #b# (but #d#), and #d# follows the
+zero-size expression.
+ #(?<=pattern)# - ^<wrap>the backward lookup. Unfortunately, the pattern must have fixed length.
+ #(?<!pattern)# - ^<wrap>the negation of backward lookup. The same restriction.
+
+ One can create named parentheses: #(?{name}pattern)#. "name" can be empty
+ (#unnamed parentheses#, which cannot be referred to) or the sequence of
+word characters (\w) and spaces (\s).
+
+ #Quantifiers#
+
+ Any character, group or class can be followed by a quantifier:
+
+ #?# - ^<wrap>Match 0 or 1 time, greedily.
+ #??# - ^<wrap>Match 0 or 1 time, not greedily.
+ #*# - ^<wrap>Match 0 or more times, greedily.
+ #*?# - ^<wrap>Match 0 or more times, not greedily.
+ #+# - ^<wrap>Match 1 or more times, greedily.
+ #+?# - ^<wrap>Match 1 or more times, not greedily
+ #{n}# - ^<wrap>Match exactly n times.
+ #{n,}# - ^<wrap>Match at least n times, greedily.
+ #{n,}?# - ^<wrap>Match at least n times, not greedily.
+ #{n,m}# - ^<wrap>Match at least n but not more than m times, greedily.
+ #{n,m}?# - ^<wrap>Match at least n but not more than m times, not greedily.
+ #{,m}# - ^<wrap>equals to {0,m}
+ #{,m}?# - ^<wrap>equals to {0,m}?
+
+
+ #"Greedy" and "not greedy" quantifiers#
+
+ Greedy quantifier captures as much symbols as possible, and only if
+ further match fails, it "returns" the captured string (the rollback
+happens, which is rather expensive).
+ When expression "A.*Z" is matched to string
+"AZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", #.*# captures the whole string, and then
+rolls back symbol by symbol until it finds Z. On the opposite, if the expression
+is "A.*?Z" then Z is found aat once. Not greedy quantifier is also known as
+#mininizing#, it captures minimal possible quantity of symbols, and only if
+further match fails it captures more.
+
+ #Special symbols#
+
+ Non-letter and non-digit symbol can be prepended by '#\#' in most cases,
+but in case of letters and digits this must be done with care because this is
+the way thew special symbols are written:
+
+ #.# - ^<wrap>any symbol except carriage return. If there is “s” among
+the options then this can be any symbol.
+ #\t# - tab (0x09)
+ #\n# - new line (lf, 0x0a)
+ #\r# - carriage return (cr, 0x0d)
+ #\f# - form feed (0x0c)
+ #\a# - bell (0x07)
+ #\e# - escape (0x1b)
+ #\xNN# - hex char, where N - [0-9A-Fa-f].
+ #\Q# - ^<wrap>the beginning of metacharacters quoting - the whole quoted
+text is treated as text itself, not the regular expression
+ #\E# - the end of metacharacters quoting
+ #\w# - letter, digit or '_'.
+ #\W# - not \w
+ #\s# - space symbol (tab/space/lf/cr).
+ #\S# - not \s
+ #\d# - digit
+ #\D# - not digit
+ #\i# - letter
+ #\I# - not letter
+ #\l# - lower case symbol
+ #\L# - not lower case symbol
+ #\u# - upper case symbol
+ #\U# - not upper case symbol
+ #\b# - ^<wrap>the word margin - means that to the left or right from the
+current position there is a word symbol, and to the right or left,
+accordingly, there is non-word symbol
+ #\B# - not \b
+ #\A# - the beginning of the text, disregard the option “m”
+ #\Z# - the end of the text, disregard the option “m”
+ #\O# - ^<wrap>the no-return point. If the matching has passed by this symbol,
+it won't roll back and and will return "no match". It can be used in complex expressions
+after mandatory fragment with quantifier. This special symbol can be used when
+big amounts of data are processed.
+ Example:
+ /.*?name\O=(['"])(.*?)\1\O.*?value\O=(['"])(.*?)\3/
+ ^<wrap>Strings containing "name=", but not containing "value=", are processed (in fact, skipped) faster.
+
+ #\NN# - ^<wrap>reference to earlier matched parentheses . NN is an integer from 0 to 15.
+Each parentheses except (?:pattern), (?=pattern), (?!pattern), (?<=pattern), (?<!pattern) and
+(?{name}pattern) have a number (in the order of appearance).
+
+ Example:
+ "(['"])hello\1" matches to "hello" or 'hello'.
+
+ #\p{name}# - ^<wrap>reference to earlier matched parentheses with the specified name.
+
+
+ #Examples:#
+
+ #/foobar/#
+ matches to "foobar", but not to "FOOBAR"
+ #/ FOO bar /ix#
+ matches to "foobar" and "FOOBAR"
+ #/(foo)?bar/#
+ matches to "foobar" and "bar"
+ #/^foobar$/#
+ matches to "foobar" only, but not to "foofoofoobarfoobar"
+ #/[\d\.]+/#
+ matches to any number with decimal point
+ #/(foo|bar)+/#
+ matches to "foofoofoobarfoobar" and "bar"
+ #/\Q.)))$\E/#
+ equals to "\.\)\)\)\$"
+
+
@KeyMacro
$ #Macro command #
Keyboard macro commands or macro commands - are recorded sequences of key