Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Regular Expressions for DarkBasic

Author
Message
aspro
14
Years of Service
User Offline
Joined: 6th May 2012
Location:
Posted: 6th May 2012 17:40
i have tried a regular expressions engine (perl compatible) with darkbasic which can be found in codeproject here...
another place for C++ coders here...
from the codeproject you can download a DLL which i will use here with darkbasic.
at first some search suggestions: suppose we want to search an alien DNA "wz12xy534562rs339tre" for the sequence "2\w\w\d3" which means :" digit 2, any char but not a digit, any char but not a digit, any digit, digit 3 "
another pattern wanted may be the sequence "2.*?3" which means: digit 2 followed by any char or digit then followed by digit 3" and we use "?" to limit the findings to the minimum groups and not the widest one.
after a ton of trials it works for me, to use mid$(string,x,y) use Matrix1Util_16 from here
http://forum.thegamecreators.com/?m=forum_view&t=85209&b=18
http://www.matrix1.demon.co.uk/Matrix1Utils_Help/Matrix1_Index.html
those are a great utilities and i think must be part of darkbasic
the following code i have attached here:
http://www.mediafire.com/download.php?q4gar4xavpibbbc
together with the libdeelx.dll regular expressions engine
1- search for a pattern ""2\w\w\d3" :




2- the following code replace cat with Lion from a file testfile.txt and output the result to a.txt



in the replace example i am not sure of the line "result$=space$(result_length*2)"
i will be glad for any modifications, or correcting. i find it strange that darkbasic don't need to declare previously the functions inside a DLL.
i attach also a vb6 project to compare.
download the projects above from here....

Login to post a reply

Server time is: 2026-07-08 05:38:15
Your offset time is: 2026-07-08 05:38:15