Jury Posted December 20, 2009 Share Posted December 20, 2009 Trust me I've been around and around with this array problem - I think it is the way my mind is structured I keep getting errors about the array not being dimensioned correctly. I've got up to the point where help is needed you'll see by the comments in the script attached what I'm trying to do. Perhaps my initial array shoud be 2 dimensional? #include <Array.au3> #include <INet.au3> Dim $count $memfile = _INetGetSource("http://www.bailii.org/ew/cases/EWHC/Ch/2009/3145.html") $array = StringRegExp($memfile, '((?i)\[\d{4}\]\s*\d*\s*[A-Z\.\&\x27\x20]{1,150}\d+(?-i)\s\([A-Z]+[a-zB]*\)|(?i)\[\d{4}\]\s*\d*\s*[A-Z\.\&\x27\x20]{1,150}\d+)', 3) for $i = 0 to UBound($array) - 1 if StringInStr($array[$i], "EWHC") Then $count = $count +1 ;here I would like construct a two to dimension array with the $array[$i] in the first dimension and the word YES in the second if the word EWHC is in the string ;or can I somhow change the existing $array to be two deminsional? Next ;the following now would display the two dimension in an array 2 columns (or three if the Row number column is manditory) by 10 rows _ArrayDisplay($array, "Citations", 1) msgbox(1, "Number of EWHC : ", $count) Thanks for any help - hints, Cheers, jury Link to comment Share on other sites More sharing options...
picaxe Posted December 20, 2009 Share Posted December 20, 2009 #include <Array.au3> #include <INet.au3> $count = 0 $memfile = _INetGetSource("http://www.bailii.org/ew/cases/EWHC/Ch/2009/3145.html") $array = StringRegExp($memfile, '((?i)\[\d{4}\]\s*\d*\s*[A-Z\.\&\x27\x20]{1,150}\d+(?-i)\s\([A-Z]+[a-zB]*\)|(?i)\[\d{4}\]\s*\d*\s*[A-Z\.\&\x27\x20]{1,150}\d+)', 3) _ArrayDisplay($array) Dim $aNew[UBound($array)][2] For $i = 0 To UBound($array) - 1 If StringInStr($array[$i], "EWHC") Then $count += 1 $aNew[$i][0] = "YES" $aNew[$i][1] = $array[$i] EndIf Next ReDim $aNew[$count][2] _ArrayDisplay($aNew) MsgBox(1, "Number of EWHC : ", $count) Link to comment Share on other sites More sharing options...
KaFu Posted December 20, 2009 Share Posted December 20, 2009 (edited) If StringInStr($array[$i], "EWHC") Then Better, I just ignored this ... Edited December 20, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Jury Posted December 20, 2009 Author Share Posted December 20, 2009 Thanks picaxe and KaFu, My mind dimensioned Dim $array_new[10][1] for a start - oh will I ever figure it out? Thanks again now I have something to ponder, jury Link to comment Share on other sites More sharing options...
picaxe Posted December 20, 2009 Share Posted December 20, 2009 Better, I just ignored this ...Been there, also 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