Extract numbers with % sign from a string
-
I need to Extract numbers with % sign from a string. Example: "50%", "test 100%","ttest 50% test test". thank you
Use a Regular Expression[^]. For example:
\d+%
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Use a Regular Expression[^]. For example:
\d+%
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
You're using the "end-of-line" anchor (
$
), but the number is not at the end of the line. You want to match the literal%
character instead.Dim number As String = Regex.Match("50%", "\d+%").Value
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
You're using the "end-of-line" anchor (
$
), but the number is not at the end of the line. You want to match the literal%
character instead.Dim number As String = Regex.Match("50%", "\d+%").Value
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer