![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | $Variables into Regular expressions ?! help I've got a requirement to find a string in an array. Simple! but I need to search on the string contained in 2 variables, So basically I'm trying. $SearchStr ="$SuppliedStr1*$SuppliedStr2" $RegStr=[regex] $SearchStr $ArrayToSearch | where { $_ -match $RegStr } This appears to work OK, BUT I need to match where $SuppliedStr2 in the End of the line in the array, so I guess I'm trying to add $ to the end of the $RegStr... . But I can't get it to work!? I'm sure this is easy for you guys that know what your doing!? Thanks in advance, hope it makes sense!!!?? Russ |
My System Specs![]() |
| | #2 (permalink) |
| | RE: $Variables into Regular expressions ?! help I'm not positive I'm understanding the question exactly, but does this work? Quote: >$SearchStr ="$SuppliedStr1*$SuppliedStr2" + '$' > $RegStr=[regex] $SearchStr > > $ArrayToSearch | where { $_ -match $RegStr } "rush" wrote: Quote: > I've got a requirement to find a string in an array. > Simple! but I need to search on the string contained in 2 variables, > > So basically I'm trying. > > $SearchStr ="$SuppliedStr1*$SuppliedStr2" > $RegStr=[regex] $SearchStr > > $ArrayToSearch | where { $_ -match $RegStr } > > This appears to work OK, BUT I need to match where $SuppliedStr2 in > the End of the line in the array, so I guess I'm trying to add $ to > the end of the $RegStr... . But I can't get it to work!? > > I'm sure this is easy for you guys that know what your doing!? > Thanks in advance, hope it makes sense!!!?? > Russ > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: $Variables into Regular expressions ?! help On May 7, 10:20*am, rush <russell.hanc...@xxxxxx> wrote: Quote: > I've got a requirement to find a string in an array. > Simple! but I need to search on the string contained in 2 variables, > > So basically I'm trying. > > $SearchStr ="$SuppliedStr1*$SuppliedStr2" > $RegStr=[regex] $SearchStr > > $ArrayToSearch | where { $_ -match $RegStr } > > This appears to work OK, BUT I need to match where $SuppliedStr2 in > the End of the line in the array, so I guess I'm trying to add $ to > the end of the $RegStr... . But I can't get it to work!? > > I'm sure this is easy for you guys that know what your doing!? > Thanks in advance, hope it makes sense!!!?? > Russ $RegStr=[regex]"$SuppliedStr1*$SuppliedStr2`$" |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| regular expressions - why are they so hard to compose and decipher? | PowerShell | |||
| regular expressions to replace but keep character? | VB Script | |||
| New lines in regular expressions | PowerShell | |||
| How to work with regular expressions | PowerShell | |||
| Regular expressions | PowerShell | |||