![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Re: how to tokenize a string into a variable via regex $string -replace '.+(.x..).+','$1' # if you're extracting hex values $string -replace '.+(0x\d{2}).+','$1' -- Kiron |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: how to tokenize a string into a variable via regex Hi, [array]$a = "nfjknvwjkvnkw0x33jniids", "snsdacjqksl0x11m;kcv;", "jnefvm;ekl;ewlv kl;0x99mkj;mkj" $regex = [regex]"0x\d{2}" $b = $a | % { $($regex.Match($_).value) } So your variables will now be: $b[0] = 0x33 $b[1] = 0x11 $b[2] = 0x99 This assumes that it will always be two digits after the 0x bit. I can see a Tao Ma or kiron masterpiece coming on here... Hope this helps, Stuart |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Find a string within a variable string | Edward.A.Gonzalez | PowerShell | 4 | 08-15-2008 08:13 AM |
| SSIS - string variable! | Daniel | .NET General | 0 | 05-15-2008 05:53 AM |
| Subject: using a Variable with/in a string | DonP | PowerShell | 2 | 02-27-2008 02:11 PM |
| Finding a regex position in a string | Jacob Saaby Nielsen | PowerShell | 7 | 11-26-2007 06:44 AM |
| Remove-item on a variable name using a regex | Marco Shaw | PowerShell | 2 | 12-07-2006 01:13 AM |