On Macros & Scripts page there is the scripts collection Find strings to new file created by me to ask the script user on execution for a regular expression search string to find strings of interest in active file and output all found strings in a new file line by line.
The scripts can be used on small files as well as on files with several MB or even GB and is very fast as it does everything in memory.
Note: The regular expression string to enter must be of Perl syntax and is applied to a JavaScript RegExp object which is not as powerful as the Perl regular expression engine within UltraEdit.
The search is executed not case sensitive as of option gi which means global case-insensitive.
For example to find and output to a new file all integer numbers within a file execute the script and enter \d+
Read also FindStringsReadMe.txt within the ZIP archive and the comments at top of the script file you want to use.
The ZIP file contains following scripts:
The line and block comments can be removed from each script file by running a replace all (from top of file) searching with Perl regular expression for ^ *//.+[\r\n]+|^ */\*[\s\S]+?\*/[\r\n]+| +//.+$ and using an empty replace string. The first part in this OR expression with three arguments matches entire lines containing only a line comment, the second part matches block comments, and third part matches line comments right to code. Removal of the comments makes the usage of a script from this collection more efficient on using it often because of JavaScript interpreter has to interpret less characters and lines.
The scripts can be used on small files as well as on files with several MB or even GB and is very fast as it does everything in memory.
Note: The regular expression string to enter must be of Perl syntax and is applied to a JavaScript RegExp object which is not as powerful as the Perl regular expression engine within UltraEdit.
The search is executed not case sensitive as of option gi which means global case-insensitive.
For example to find and output to a new file all integer numbers within a file execute the script and enter \d+
Read also FindStringsReadMe.txt within the ZIP archive and the comments at top of the script file you want to use.
The ZIP file contains following scripts:
- FindStringsToNewFile.js
searches in entire active file for strings with a regular expression and outputs only all found strings or even only parts of the found strings line by line to a new file. It can be used for small files with some KiB and larger files up to a few MiB. - FindStringsToNewFileExtended.js
is like FindStringsToNewFile.js with the difference that it can be used also for really large files with many MiB or even GiB. This script can't be used with UE for Windows v13.00 and UES v6.20. - FindStringsWithLineNumbers.js
is like FindStringsToNewFile.js with the difference that line number information is also output on every line with a found string in the new file. This script can be used for small files with some KiB and larger files up to a few MiB. - FindStringsWithLineNumbersExtended.js
is like FindStringsWithLineNumbers.js with the difference that it can be used also for really large files with many MiB or even GiB. This script can't be used with UE for Windows v13.00 and UES v6.20.
The line and block comments can be removed from each script file by running a replace all (from top of file) searching with Perl regular expression for ^ *//.+[\r\n]+|^ */\*[\s\S]+?\*/[\r\n]+| +//.+$ and using an empty replace string. The first part in this OR expression with three arguments matches entire lines containing only a line comment, the second part matches block comments, and third part matches line comments right to code. Removal of the comments makes the usage of a script from this collection more efficient on using it often because of JavaScript interpreter has to interpret less characters and lines.
Blarneystone likes this post