How to remove only numbers from string

I want to remove only numbers from string.
Example:
Input:
“I want 12345 only var2 variable from 234567 or 6775 data”
Output:
“I want only var2 variable from data”

Hey,
try to use:
System.Text.RegularExpressions.Regex.Replace(myStr ,“\d”, “”)

2 Likes

in addition to:

grafik

Kindly note:

  • some enhancements are to do for additional spaces and keeping var2
    grafik

  • the difference to your output: from data vs. from or data

or is not a number, so we do not remove. Maybe the requirements are to redefine

2 Likes

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