I have made a data scraping process that takes data from a word document and outputs it to Excel. The scraping of the data is fine, but I have noticed that a lot of the values are followed by \r, \n, \a,or \t. I have got a Regex.Replace working on one String value.
I tried putting an Array of Strings into where the String Variable name goes, but it gave me a validation error, saying that 1-dimensional array of string can’t be converted to string.
Can I modify the Regex to replace everything in the array? If so, how do I do that? Any help is appriciated
@william.coulson
working with for each is recommandable, as the implementation can be very well inspected and tracked.
Still you will have an option for following oneliner, used within an assign without for each:
OutputArray.Select(Function (s) System.Text.RegularExpressions.Regex.Replace(s,“\r|\a|\t|\n”,“”).toArray (or toList if you prefer)
ther return will be a string array
about the search pattern maybe with \s|\a it can be shortened
I used message boxes to see the values and the Regex is working, but it is not outputting them correctly on the Excel sheet, as they still have Character Escapes following them
You can create a new array (outside the loop) & add item to it in the loop after the assign activity. Soething like this NewArray(LoopIndex) = item. The original array won’t be updated automatically.