New features in GS-Base 22.2
-
In the “Verify Files” window you can now specify a list of locations
(disks, folders) to be scanned using one list. Simply add subsequent
locations separated by the semicolon “;”
If you use the “Select Folder” dialog box, it’ll insert the
selection at the current cursor position.
Multiple locations enable you, for example, to monitor files and
effectively find similarities or duplicates across multiple disks.Online help:
Verifying File (Path) Lists in Tables -
Regular expressions have been added to the “Find()” formula and
to the “Replace()” formula.find(pattern, subject, [start], [flags])
The optional 4-argument find() version accepts regular expressions
as ‘pattern’ and can perform both case-sensitive and caseless
comparisons.
The ‘flags’ parameter can be any combination (sum) of the following
options:
1 - ‘pattern’ is a regular expression,
2 - use case-sensitive string comparison (regular expressions
switches can override this),
4 - the matching substring is returned or an empty string instead
of its position,
32, 64, 128 - find the 2nd, 3rd or 4th capturing group (the 1st is
the default one).=find(“e*\d”, “abcdef abcee abcde5”, 1, 1) returns 18
replace(pattern, subject, start, replace, [flags])
The optional 5-argument replace() version accepts regular
expressions as ‘pattern’ and ‘replace’ arguments and can perform
both case-sensitive and caseless comparisons.
It searches ‘subject’ for ‘pattern’ starting at the position ‘start’
and replaces all found occurrences with ‘replace’.
The ‘flags’ parameter can be any combination (sum) of the following
options:
1 - ‘pattern’ is a regular expression,
2 - use case-sensitive string comparison (regular expressions can
overwrite this).The ‘replace’ argument can be:
(1) absolute references (by number) to capturing subpatterns, eg.
\1, \2…\999,
(2) \l, \L, \u, \U literals to (binary) switch upper- and
lower-case conversion,
(3) \r, \n - ‘line feed’ and ‘new line’ literals (by default,
pressing Ctrl+Enter when editing fields inserts the \r\n
sequence).=replace(“(.)a+\d{1,3}”, “abc aa0102”, 1, “\1”, 1) returns ‘abc 2’
=replace(“(ab)”, “abcdef ghijk abb123”, 1, “\u\1”, 1) returns “ABcdef ghijk ABb123” -
Although regular expressions can already be used with the manual
“Edit > Find / Replace” commands, supporting them in the above
formulas greatly simplifies all cases where you need to find or
convert something within the calculated fields.The “Field Setup” dialog box screen shot:
https://citadel5.com/help/gsbase/field_setup.pngFor example, to find/extract the extension from file path in
“field1” and place them in the “field2”, for the “field2” field in
the “Field Setup” dialog enter the calculation formula as:=find("(\.[^.]+)$", field1, 1, 1 + 4)
To find/extract a folder from a file path:
=find("^(.*[\\\/])?(\.*.*?)(\.[^.]+?|)$", field1, 1, 1 + 4 + 32)
To find/extract the file name without the extension and path:
=find("^(.*[\\\/])?(\.*.*?)(\.[^.]+?|)$", field1, 1, 1 + 4 + 64)
To remove duplicated words in field1:
=replace("\b(\w+)(?:\W+\1\b)+", field1, 1, "\1", 1)
To create abbreviations consisting of first letters of words:
=replace("(\b\w)(\w*(\W+|\z))", field1, 1, "\1", 1)
To create abbreviations consisting of first letters of words
leaving full numbers:
=replace("(\b\w(\d*))(\w*(\W+|\z))", field1, 1, "\1", 1)
To mask IP addresses partially (e.g. 11.12.13.114 to 11.12.13.*):
=replace("\b((\d{1,3}\.){3,3})\d{1,3}\b", field1, 1, "\1\*", 1)
For other examples, please see the “Full text searches and
replacing” help topic.As regular expressions are extremely popular, even if you’re not
familiar with them, whenever you need to use any specific find()
or replace() patters, you can simply enter your questions in Google,
like “regular expression to find file extensions”