Edit string to remove text

Got a string I am getting from a webpage. It includes an incident number followed by the words “incident description” I want to remove everything expect the numbers.

I am using the community addition. I don’t think I have access to things like .trim or .substring. If I do they are not auto filling. Am I missing something?

Previous solution doesn’t seems to be working

Create a variable Regex with System.Text.RegularExpressions.Regex

Regex.Replace(text, "[^0-9]+", "")

1 Like

You should

Hey @fdfalor

Its not about community version or Licensed one.

The Problem might be you are trying it on “Generic” data type. Not sure but may be. If you will use it with string Data type variable then you will be able to see it or you can try like this as well

.ToString().Trim and same


Thank you that was it!

Hi vvaidya,
You had me curious with your previous solution.
I think you needed “AddressOf Char.IsDigit” to make it work after doing research.

Here’s what I ended up with (“text” being variable with the string):
String.Concat(text.Where(AddressOf Char.IsDigit))
and IsDigit can be replaced with other booleans

That is supposedly faster than Regex but I think both solutions work.


Great! Thanks for checking.