Trying to turn this (string):

"one";"two";"three";"four"

Into this (text array):

one
two
three
four

Using this:

$pattern := "/;/"
$num := regex split($pattern; $list; $chunks)

$pattern := "/^\"(.*)\"$/"
$replacement := "\1"
regex replace($pattern; $chunks; $replacement; $smallchunks)


And 4D v11.5 will crash.

The key seems to be that when the subject to be searched (in this case
$chunks) is an array, regex replace is supposed to walk all the
elements of the array and perform the search/replace on each of them.
If inSubject is a string, it works.  If inSubject is a string/text
array, 4D crashes.

The work around to the above is simply use for each:

        $pattern := "/;/"
        $num := regex split($pattern; $list; $chunks)

        $pattern := "/^\"(.*)\"$/"              // find any string surrounded 
by ""
        $replacement := "\1"                    // use string without ""
        for each ($chunks;$chunk;$index)
                regex replace($pattern; $chunk; $replacement; $chunks{$index})
        end for each    


Thanks,

Michael Check
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to