Solved

regex help

Posted on 2014-03-16
2
166 Views
Last Modified: 2014-03-16
I'm looking for syntax to do the following

original string
01 A Text String

desired replacement
01 - A Text String

I just need to insert a dash between the numeric and the alpha as shown.
There is the one occurrence of this pattern only in the string.

Thanks
0
Comment
Question by:dgrafx
2 Comments
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 39932530
"01 A Text String" -replace '(\d+)\s(.+)', '$1 - $2'

Open in new window

will search for arbitrary number of digits, followed by space, followed by arbitrary characters.
0
 
LVL 25

Author Closing Comment

by:dgrafx
ID: 39932534
perfect - thanks ...
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Set OWA language and time zone in Exchange for individuals, all users or per database.
This article will help you understand what HashTables are and how to use them in PowerShell.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question