Jump to content

Recommended Posts

Posted

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

Posted

#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)

Posted

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

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...