Jump to content
Sign in to follow this  

Finding unknown strings in files

Recommended Posts


Hi community,

I'm almost sure you can do this, and i think it may be a bit hard, so it's just an idea more than a real project. I was wondering if it's possible to open any kind of file in txt format (also by renaming them .txt) and check into them full lenght deep for the largest recursive string.

The main idea behind this is:

1)Do some exercise with strings.

2)While doing point 1, creating a very rough compression algorithm to compress files.

So the idea behind this is this:

For example i have a txt file like this:


And so on. I colored some recursive strings you can find in the file. The idea is to open any file, scan the given file for the largest recursive string, then convert it to a shorter one and substitute it to the original one.

Example: tttttttr4ttt would become a random charachters set(maybe done with Chr(Random(1,500,1) or just decided by me) like 12XY. So all the tttttttr4ttt would be replaced with 12XY and the file would be smaller. Decompressing would be the opposite. All the corrispondences (12XY would be stored in the file or in a ini file and deleted after decompressing is done. Is this possible/worth a try?

Share this post

Link to post
Share on other sites

You are confusing "recursion" and "repetition".

Anyway, try by "simply" follow your agenda and imagine a general algorithm able to determine the string with will be the first best candidate for compression (most repeated and largest).

Hint: in your example string, if abcde is repeated 5 times or more, it becomes a better choice than tttttttr4ttt which is only there twice.

That itself would be a very good exercise. Then find out how you could go through the whole file by making such substitutions one after the other. Then estimate the complexity of your algorithm. Then study a classical scheme (eg. ZLW) and find avenues of improvement. You'll learn a lot.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post

Link to post
Share on other sites

Here are some examples about compression:







Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post

Link to post
Share on other sites

Thanks. On my way to learning.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this