Jump to content

Read TXT data with RegEx


Recommended Posts

I created a .txt db and i want to read the values using the RegEx (i know that iniread exists but i wanna know how regex works and creat my "own database") Btw, where could i find a good tutorial explaining how regex works? I read the help file but it did not help me much.

My .txt data:

051=88343028.2365754
052=19078966.1324966
053=61125189.3627208
054=48630688.0627125
055=65556281.3590232
056=48912705.1316237
057=60764618.3087908
058=3329069.66959535
059=98765958.9522598
0510=80757418.0493819
0511=85644294.163586
0512=82394592.0824025
0513=53262646.2197832
0514=77111584.5041542
0515=15618731.8799041
0516=96351384.9912536
0517=10705940.2717704

 

I'm reading than with this function, but i don't know if it is 100% correct:

$ret = StringRegExp(fileread("data.txt"), '(?i)' & $sControl & '=(.*)', 3)
_arraydisplay($ret)

 

 

Thx!

Edited by x_bennY
Link to comment
Share on other sites

@x_bennY

7 hours ago, x_bennY said:

Btw, where could i find a good tutorial explaining how regex works?

Have you tried the Internet?  If not, you can start here:  http://lmgtfy.com/?s=d&iie=1&q=regular+expression+tutorial  Then, find what works best for you.

:idea:

Edited by TheXman
Link to comment
Share on other sites

I'm not stupid, and yes, i tried (should i really need to answer it?). As i asked, i want a good tutorial with autoit functions, and this is not what i was really asking for.

Your answer is totally contemptible. if you don't know how to help, or don't whant to, don't waste your time posting these things...

Edited by x_bennY
Link to comment
Share on other sites

Don't get mad at me.  If you ask a dumb question, don't be surprised if you get a dumb answer.  I quoted your question.  It does not mention StringRegexp or AutoIt functions.  Here it is again for your viewing pleasure.  Regex is not exclusive to AutoIt so what would make one think that you were referring to AutoIt functions?
 

14 hours ago, x_bennY said:

Btw, where could i find a good tutorial explaining how regex works?

Whether you are stupid or not is debatable.  But one thing is for sure and that is that you are factually dishonest.

:bye:

Link to comment
Share on other sites

Indeed there are many (zillions of) good tutorials on regular expressions floating around.
However be sure you focus on PCRE flavor, which AutoIt uses.

The definitive documentation on the version currently implemented in AutoIt (PCRE1) can be found here : https://www.pcre.org/original/doc/html/pcrepattern.html

Also AutoIt help file documents most used features, albeit not being a regexp primer.

See my signature for an excellent site offering compatible regexp support, including step by step debugging and a detailed strict explanation of what a given pattern means, in plain english.

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)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...