Tom
2016-05-24 12:11:48 UTC
Hi,
I have the following code:
$Tel_File = gc '.\out.tel'
foreach ($r in $array_ref) {
Write-Host "Looking for:" $r
if ($Tel_File -match ".*_AC_.*$r.*")
{
write-host "$r Connect to AC"
}
elseif ($Tel_File -match ".*VCC(\d+)?_.*$r.*")
{
write-host "$r Connect to VCC"
}
}
The $Tel_File is a little over 2000 lines long and looks like:
'V2P5_AVIN' ; C170:F133.1 R354:F136.1 U45:F132.39
Some lines are much longer..
The foreach can have well over 100 entries, which has "C170" ($r). It's the regrex matching that appears to be very slow...
How can I get this to run faster?
Thank you for any help in advance!
-Tom
I have the following code:
$Tel_File = gc '.\out.tel'
foreach ($r in $array_ref) {
Write-Host "Looking for:" $r
if ($Tel_File -match ".*_AC_.*$r.*")
{
write-host "$r Connect to AC"
}
elseif ($Tel_File -match ".*VCC(\d+)?_.*$r.*")
{
write-host "$r Connect to VCC"
}
}
The $Tel_File is a little over 2000 lines long and looks like:
'V2P5_AVIN' ; C170:F133.1 R354:F136.1 U45:F132.39
Some lines are much longer..
The foreach can have well over 100 entries, which has "C170" ($r). It's the regrex matching that appears to be very slow...
How can I get this to run faster?
Thank you for any help in advance!
-Tom