I\'m trying to remove any currency symbol from a string value.
using System;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace Win
Don't match the symbol - make an expression that matches the number.
Try something like this:
([\d,.]+)
There are just too many currency symbols to account for. It's better to only capture the data you want. The preceding expression will capture just the numeric data and any place separators.
Use the expression like this:
var regex = new Regex(@"([\d,.]+)");
var match = regex.Match(txtPrice.Text);
if (match.Success)
{
txtPrice.Text = match.Groups[1].Value;
}
The answer from Andrew Hare is almost correct, you can always match digit using \d.*, it will match any digit to your text in question.