I have a string that varies
BLUE ORIGIN CONTACT: MB
The first part is what varies, it's basically a customer name. So the number of characters and spaces will change.
I know I can use this and it will match what I need
$String = 'BLUE ORIGIN CONTACT: MB'
$string -match '(^\S+\s+\S+)(\s+)(CONTACT:)(\s+)(\S+)'
$Matches[1]
But if the string changes to something like this, with no spaces
CUSTOMERNAME CONTACT: MB
the -match is false.
How can I do a regex that grabs the first part of the string regardless of its length or characters?
Probably wasn't super clear. The Values I am after are
$Matches[1] - In the above would be BLUE ORIGIN
$Matches[3] - CONTACT:
$Matches[5] - MB
[A-Za-z\s]+CONTACT:\s+\S+\t) betweenORIGINandCONTACT?CONTACT:guaranteed to be fixed-length? If so, do you know what that length is?