I have a string which will have an unknown quantity of non-alphabetical characters. I would like to remove these from my string. I want everything to the right of the first occurrence of a letter.
eg
'3434 34^%43 346&*^& 8 645 Stuff' becomes 'Stuff'
'345$65556&5$&9MoreStuff' becomes 'MoreStuff'
'34*^$76$::^5{][][65And EvenMoreStuff 123! But ItBeganWithA Letter' becomes 'And EvenMoreStuff 123! But ItBeganWithA Letter'
Using PowerShell 5.1
Thanks for your help!
You could use the following regex to remove any leading non-letter characters:
'3434 34^%43 346&*^& 8 645 Stuff' -replace '^[^\p{L}]*'
Pattern describes:
^ # start of string
[^\p{L}]* # 0 or more characters that are not letters (\p{L} == unicode category "letters")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.