Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Embedded Period Regex

$
0
0

I am trying to parse out words from a file using:

$string = "Ziggy Ziggy.stardust Ziggy."

$string -split "\W+"

Ziggy
Ziggy
stardust
Ziggy


I want to be able to have output as follows (i.e. don't split on periods in the middle of the word, but do if it's the last character of a word:

Ziggy
Ziggy.stardust
Ziggy

My next step is to make a list of phrases that use this construct, but to capture a phrase (2+ construct words).


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>