Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Selecting strings with numbers and words

$
0
0

Hello,

I have some output that looks like :

some text I don't care about

StartValues

blah blah blah blah blah

1.word:1111

blah blah blah blah blah

2.Anotherword:247120472190

 

...etc

 

I've been trying to capture just the lines that are in the number.word:number , so I tried

 

[string[]]$MyVar= ($OutputString-split'StartValues')[1].split() |Select-String-Pattern$trialRegex2

 unfortunately I can't seem to get the regex correctly

 

I've tried

 

$trialRegex="(\d)^.(\w)"

 

$trialRegex2

 

 

='\d+^.\w+'

$trialRegex3 ='(\d+)^.(\w+)'

 

 

 

 

 

What am I doing wrong? Am I even supposed to be using -pattern and regex here?

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 6937

Trending Articles