RegEx for eliminating whitespace to the first alpha character

Hi all (and Kem :slight_smile: ),

I have a scenario where I’m being hammered with Null and space characters from a shell process leading up to the first character of the true output. This could be any number of non-alpha characters and seems to be dependent on the time between output from the source tool.

I test the RegEx pattern with RegExExpress and it works and I get the string with the non-alpha whitespace removed:


But within Xojo, I only get the first character followed by the first space and then the next character (which then cases a OOBE in my parser).

My Xojo code is dead simple:

re.SearchPattern = "\\S*[a-zA-Z0-9]\\x20*[a-zA-Z0-9]" reMatch = re.Search(jobData(x)) If reMatch <> Nil Then jobData(x) = reMatch.SubExpressionString(0) End If

You are too lazy. Happened to me this week, too. Change from lazy to greedy.