jchd Posted September 9, 2013 Share Posted September 9, 2013 If you have to process text with uncommon newline ending (here I mean "uncommon in Windows world") then you're free to force whatever convention of your choice/need. Still making the regexp default coïncide with what is the OS default (or tradition if you prefer) used by 99.999% of Windows programs seems like a safe idea. Also it's relatively frequent to see lone @LFs or @CRs mean a line break inside some multi-line field of a .CSV file, itself line-delimited by @CRLF. Making the latter a default would devastate the reading. 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
DXRW4E Posted September 9, 2013 Share Posted September 9, 2013 (edited) Hi jchd, that I know very well, but we're talking about a default setting, Windows knows these line (run this inf file in system) FileWrite(@DesktopDir & "\test.inf", @LF & @CR & '[Version]'& @LF & @CR & 'Signature="$Windows NT$"' & @LF & @CR & _ '[DefaultInstall]' & @LF & @CR & 'AddReg = AddReg.Section' & @LF & @CR & _ '[AddReg.Section]' & @LF & @CR & 'HKCR, "...Test", , ,"Test"') in this case StringRegExp() No?, I do not think which is a good idea to tell all users always use the newline convention if you use RegExp in AutoIt?, I'm just saying what I think, I do not know hmmmmm after that I do not understand who the point, when we can do it why not do it, does not lose anything in performance Ciao. Edited September 9, 2013 by DXRW4E Link to comment Share on other sites More sharing options...
jchd Posted September 9, 2013 Share Posted September 9, 2013 Please realize that your twisted example is precisely an instance of problematic source, since it will double or not, depending on the tool you use, the number of lines you seem to think it contains. Contrary to what you pretend, I'm not "telling users to always use the newline convention if they use RegExp in AutoIt". This is only needed when/if you ever process very unusual files. I find it unfair that you put your own, biaised words in my mouth. I'm not against changing the default convention (clearly, as I was just doing that!), but I'm waiting to see concrete advantages examples of (*ANYCRLF) massively outweight real-world drawbacks of (*CRLF) to be convinced. 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
saudumm Posted September 9, 2013 Share Posted September 9, 2013 (edited) it seems some bug/regress in _ArrayDisplay() - unlike 3.3.8.1 in 3.3.9.20 you can't change window size by dragging it's borders... The window is still resizable, but the mouse cursor doesn't change. This problem exists with all resizable AutoIt GUIs, so it seems related to the recent mouse cursor changes, not to _ArrayDisplay(). I filed a bug report for this. Edited September 9, 2013 by saudumm Link to comment Share on other sites More sharing options...
DXRW4E Posted September 9, 2013 Share Posted September 9, 2013 (edited) the current setting says, if not @CRLF that is not NewLine, if a user has a Mac file or whatever in @CR only or @LF only, then that file is not valid file? (Windows and all other applications that run in Windows, do not say so, but say that is valid file ehhh ), and after need prevent everything manually?, in poor words is equal how to tell if a file is not ASCII then is invalid file, since the majority of the files are ASCII (or if a textdata .txt file saved in Mac or Linux that is not a valid .txt file in Windows?), I think instead which by default AutoIt will have to know everything that the Windows by default knows (example is in the post above), as always I'm just saying what I think personally, nothing else, for more and still do not understand where is the problem that one thing should not be flexible hmmmmmmm, and is very simple it does not matter right or wrong or how you think or what I think, AutoIt (is forced) will need to know by default everything that Windows by default knows Ciao. Edited September 9, 2013 by DXRW4E Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 9, 2013 Author Administrators Share Posted September 9, 2013 I guess that FileReadLine() will accept all three variants by default so maybe the default pcre option should mirror. Does anycrlf cause issues with standard crlf windows files? Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
DXRW4E Posted September 9, 2013 Share Posted September 9, 2013 (edited) normally and logically No, will not have to be any kind of problem between (*CRLF) and (*ANYCRLF) http://www.autoitscript.com/autoit3/pcrepattern.html (*CR) carriage return (*LF) linefeed (*CRLF) carriage return, followed by linefeed (*ANYCRLF) any of the three above (*ANY) all Unicode newline sequences Ciao. Edited September 9, 2013 by DXRW4E Link to comment Share on other sites More sharing options...
jchd Posted September 9, 2013 Share Posted September 9, 2013 Shit, the answer vanished in space! I hate the web for that. In short I was saying: why not. There are good arguments pro and contra which I'm not going to type again. Fucking web. Also the question arises for R. Maybe we should make (*BSR_ANYCRLF) by default as well, since 0x85 is relatively common in ANSI files. 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
DXRW4E Posted September 9, 2013 Share Posted September 9, 2013 (edited) the answer vanished in space! not true Hi jchd, you're the guy who was very active there, and Thanks you very much (Seriously ) again for all the details about RegExp (or even in firefox favorite http://www.autoitscript.com/autoit3/mvps/jchd/PCRE%20documentation/pcrepattern.html I helped a lot to revise certain things more better), but I still believe that set for strength @CRLF only is a Very wrong choice, looking at the situation in general and for all the reasons written in all the posts above Ciao. Edited September 9, 2013 by DXRW4E Link to comment Share on other sites More sharing options...
jchd Posted September 9, 2013 Share Posted September 9, 2013 It may be very wrong from your point of view for your routine use cases. I'd rather say it's marginally wrong for people having to routinely process "foreign" files. But since these are essentially power-users, I'd say it's only sugar for not having to force another convention. The question for R remains open and if (*ANYCRLF) is retained, then (*BSR_ANYCRLF) would be a more consistent choice: current (*BSR_UNICODE) default will take 0x85 (ellipsis in many ANSI codepages) as a line break (also Vertical Tab, but this control char is rare). I'll now leave it to Jon to decide what's best. (*ANYCRLF) will work on essentially all files whatever OS or program produced them, but may confuse users in situations where separate CR or LF don't mean a new line (or record). (*CRLF) will work unsurprisingly for all Windows files but may require rare users processing rare foreign text to use another convention. Time to close eyes! 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
jpm Posted September 10, 2013 Share Posted September 10, 2013 http://www.autoitscript.com/autoit3/mvps/jchd/PCRE%20documentation/pcrepattern.html this link does not point to the current beta pcre support. Your previous http://www.autoitscript.com/autoit3/pcrepattern.html is the correct one for the current beta not sure jchd hav really edited an old version Link to comment Share on other sites More sharing options...
jchd Posted September 10, 2013 Share Posted September 10, 2013 Should be 8.33, I'll check later today. 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
Administrators Jon Posted September 10, 2013 Author Administrators Share Posted September 10, 2013 I'll now leave it to Jon to decide what's best. (*ANYCRLF) will work on essentially all files whatever OS or program produced them, but may confuse users in situations where separate CR or LF don't mean a new line (or record). (*CRLF) will work unsurprisingly for all Windows files but may require rare users processing rare foreign text to use another convention. Time to close eyes! I'm going to go for *ANYCRLF as default. Shoot me! (Edit: I Love how until this was brought up, the old default of LF was fine...haha) James 1 Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
BigDod Posted September 10, 2013 Share Posted September 10, 2013 Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
jchd Posted September 10, 2013 Share Posted September 10, 2013 Not as fine as you think it was.I remember having to circumvent things a couple of times. There must ce also tracks in the answers posted here and there. But yes I was unsuspecting that such a brilliant personality as you would have left such a wide hole in the perfect AutoIt galaxy. Oops, going to be shot down! I'll fix the doc accordingly. What's your opinion regarding R and (*BSR_ANYCRLF) vs. the current default (*BSR_UNICODE)? 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
DXRW4E Posted September 10, 2013 Share Posted September 10, 2013 (edited) this link does not point to the current beta pcre support. Your previous http://www.autoitscript.com/autoit3/pcrepattern.html is the correct one for the current beta not sure jchd hav really edited an old version Hi jpm, Thank you @OffTopic RegExp never ends to learn it ehhh, the http://www.autoitscript.com/autoit3/mvps/jchd/PCRE%20documentation/pcrepattern.html has been updated before the official page http://www.autoitscript.com/autoit3/pcrepattern.html and even also brings in pages like http://www.autoitscript.com/autoit3/mvps/jchd/PCRE%20documentation/index.htmlcertainly today I always refer only to the official page http://www.autoitscript.com/autoit3/pcrepattern.html (that even saved in HTML and in PDF the old and the new page, since long ago that page went offline for months ehhhh, However now almost everything of pcrepattern.html is already in AutoIt.chm ) but long ago http://www.autoitscript.com/autoit3/mvps/jchd/PCRE%20documentation/pcrepattern.html has been really helpful to understand some more good stuff Ciao. Edited September 10, 2013 by DXRW4E Link to comment Share on other sites More sharing options...
jpm Posted September 10, 2013 Share Posted September 10, 2013 In fact there must be 2 pages one for the release and one for the beta. I think Jon update the http://www.autoitscript.com/autoit3/pcrepattern.html and now this one point to the beta based on 8.33 not sure the one of jchd is referring to the release with is based on pcre 8.12 Link to comment Share on other sites More sharing options...
jchd Posted September 10, 2013 Share Posted September 10, 2013 I copied 8.33 to my space some time ago, right after the beta went alive again and Jon compiled it with UCP support. I would also recommend to append the PCRE version to the doc name in the repository, so that successive releases and beta can refer to their exact reference doc. 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
mLipok Posted September 10, 2013 Share Posted September 10, 2013 Nope. All I've done so far is to change the error message to show what file has an error. So it would be worth trying again to see what it says. I'll check today or tomorrow and will put the relevant information in that thread. I spoke badly, I mean, that previous thread, not this one. Please see the continuation of that previous thread: Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
kylomas Posted September 10, 2013 Share Posted September 10, 2013 jchd, I don't know if this is a problem, expected behaviour or my ineptitude with regexp. When I run the following code under 3.3.8.1 I get an output file without line #1 as expected, however, the EOL chars are changed to CR (as reported by Notepad++). When I run the same code under 3.3.9.20 I get NO EOL chars. local $str = _ 'line 1' & @crlf & _ 'line 2' & @crlf & _ 'line 3' & @crlf & _ 'line 4' & @crlf & _ 'line 5' & @crlf $str = stringregexpreplace($str,'(?:.*\R)?(.*)','\1') local $f2 = @scriptdir & '\test2.txt' filedelete($f2) filewrite($f2,$str) ShellExecute($f2) kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now