Sign in to follow this  
Followers 0
kor

How can I StringRegExpReplace inside an array?

4 posts in this topic

#include <File.au3>
#include <array.au3>

Dim $array[13]
;_FileReadToArray($file, $array)

$array[0] = "X-GWRECORDID:4C4AE09E.DIST_DOMAIN.DIST_PO.100.1647274.1.2553.1"
$array[1] = "ORGANIZER;CN=aname;ROLE=CHAIR:MAILTO:somename@email.com"
$array[2] = "ATTENDEE;CN=aname;ROLE=REQ-PARTICIPANT:MAILTO:somename@email.com"
$array[3] = "ATTENDEE;CN=aname;ROLE=REQ-PARTICIPANT:"
$array[4] = "MAILTO:jjohn@email.com"
$array[5] = "ATTENDEE;CN=John John;ROLE=REQ-PARTICIPANT:"
$array[6] = "MAILTO:somename@email.com"
$array[7] = "DESCRIPTION:"
$array[9] = "DTEND:20100728T193000Z"
$array[10] = "LOCATION:A good place"
$array[11] = "SEQUENCE:7"
$array[12] = "UID:20100724T194610Z_C0EF0025@email.com"

$result = StringRegExp($array[4], "email.com")
consolewrite($result & @CR)

StringRegExpReplace($array[4], "email.com", "differentemail.com")

consolewrite($array[4] & @CR)

Having problems replacing parts of items inside array rows.

Share this post


Link to post
Share on other sites



You need to assign the variable.

$array[4] = StringRegExpReplace($array[4], "email.com", "differentemail.com")

Share this post


Link to post
Share on other sites

Having problems replacing parts of items inside array rows.

As Malkey said:

#include <File.au3>
#include <array.au3>

Dim $array[13]
;_FileReadToArray($file, $array)

$array[0] = "X-GWRECORDID:4C4AE09E.DIST_DOMAIN.DIST_PO.100.1647274.1.2553.1"
$array[1] = "ORGANIZER;CN=aname;ROLE=CHAIR:MAILTO:somename@email.com"
$array[2] = "ATTENDEE;CN=aname;ROLE=REQ-PARTICIPANT:MAILTO:somename@email.com"
$array[3] = "ATTENDEE;CN=aname;ROLE=REQ-PARTICIPANT:"
$array[4] = "MAILTO:jjohn@email.com"
$array[5] = "ATTENDEE;CN=John John;ROLE=REQ-PARTICIPANT:"
$array[6] = "MAILTO:somename@email.com"
$array[7] = "DESCRIPTION:"
$array[8] = "Where was it? ;-)"
$array[9] = "DTEND:20100728T193000Z"
$array[10] = "LOCATION:A good place"
$array[11] = "SEQUENCE:7"
$array[12] = "UID:20100724T194610Z_C0EF0025@email.com"

For $i=0 to UBound($array)-1
$array[$i]=StringRegExpReplace($array[$i], "email.com", "differentemail.com")
Next

_ArrayDisplay($array)

Share this post


Link to post
Share on other sites

got it. Thanks guys!

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0