Edit items after RegEx is completed

Hey,

So I am having a hard time figuring this out:

I am running a RegEx and it returns all numbers like 100 000, 200 000, 300 000.

The issue is I can’t convert these numbers into integers. I get an error. So then I tried in a for each loop:

item.tostring.replace(" “,”"). --> This wsa to remove the space and try and convert it into an integer. However, when i tried this, it wouldn’t replace the space. It just continued to come up as 100 000.

So then I tried to split it into an array by the blank space. However, when i try and split it and read the first one it still comes up as 100 000.

ANY IDEA how to remove the space in between 100 and 000? Do regular string manipulations not work for Regex outputs?

Once you got the regex result, try,

Regex.Replace(regexResultString, “\s+”, String.Empty)

Then, Use convert function.

2 Likes

ah great so a regex specific replace function. I was using a string replace function. Thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.