Jump to content

Recommended Posts

Posted

I'm having issues with an table that has a CRLF that I've grabbed using this command

Local $oTable = _IETableGetCollection($oIE, 1)
Local $aTableData = _IETableWriteToArray($oTable,True)

column 3 has a CRLF and then the word NAME: for every row in the array.

I'm trying to figure out how to replace any occurrences of @CRLF"NAME: " with the delimiter |. Any tips?

Posted

I have been messing with those, but I don't think I understand completely how to execute them:

_ArrayDisplay(StringReplace($aTableData,(@CRLF"Name :"),"|"))

I've tried various iterations of this but every time the search string gives me an error when it gets to the @CRLF. If I put @CRLF in quotes, nothing shows up.

Sorry if this is a dumb question. I'm just getting use to autoit, so some of the more complicated processes I'm trying to do get me very confused.

I was using Powershell to do some of these (saved the array to a file and then ran the following powershell):

$filepath = "C:\Automation\AutoIt\log\example.txt"
$outfile = "C:\Automation\AutoIt\log\outfile.csv"

(Get-Content $filepath -raw) | 
Foreach-Object {$_ -replace "Name: ", "`"|"`
-replace "`n`"", ""`
} | Set-Content $outfile

but I was getting really inconsistent results with powershell. I was hoping I could do this whole thing with autoit.

Posted

I got an error 

For $j = 0 To UBound($aTableData),2) - 1
                                  ^Error

Illegal text at the end of statement (one statement per line)

Posted

Error again

For $j = 0 To UBound($aTableData[$i], 2) - 1
For $j = 0 To UBound(^ ERROR

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded

Posted

That did it!

Thanks!

Jury, if you update it again I'll mark it as solved.

Posted (edited)

(?-s)(?-i) is the same as (?-is) and negates s and i options from there on. See options § in help. Pretty useless in this case since both are OFF by default.

r?n can be replaced by R

Edited by jchd

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)

Posted

Well, not completely useless if you are an old bloke and want constant reminding exactly what any given regEx is doing. :

But thanks for the explanation.

Posted

jc, my question was not specific enough... saying 'what is it for' I didn't ask for 'what does that mean' but : what is the use of this, except if used in the middle of a pattern to restore default(s)  :)

Posted

These are regEx Modifiers

I almost always use them to make my regular expressions more explicit and they enable one to modify what a given regEx is doing mid-expression e.g. ignoring the case of letters until you get to a certain point then turning case sensitivity on OR ignoring line returns/carriage returns until a certain point then recognising them again.   

As one of the worlds top experts - Jan Goyvaerts explains:


(?i) Turn on case insensitivity for the remainder of the regular expression. (Older regex flavors may turn it on for the entire regex.) te(?i)st matches teST but not TEST.

(?-i) Turn off case insensitivity for the remainder of the regular expression. (?i)te(?-i)st matches TEst but not TEST.

(?s) Turn on "dot matches newline" for the remainder of the regular expression. (Older regex flavors may turn it on for the entire regex.)

(?-s) Turn off "dot matches newline" for the remainder of the regular expression.

(?m) Caret and dollar match after and before newlines for the remainder of the regular expression. (Older regex flavors may apply this to the entire regex.)

(?-m) Caret and dollar only match at the start and end of the string for the remainder of the regular expression.

(?x) Turn on free-spacing mode to ignore whitespace between regex tokens, and allow # comments.

(?-x) Turn off free-spacing mode.

(?i-sm) Turns on the options "i" and "m", and turns off "s" for the remainder of the regular expression. (Older regex flavors may apply this to the entire regex.)

(?i-sm:regex) Matches the regex inside the span with the options "i" and "m" turned on, and "s" turned off.

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
  • Recently Browsing   0 members

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