2
I am trying to format this text with regex but do not have the desired return:
Of:
"ST STN, SET J, ? SHOPS T-40 /T41, - TER-REO, SHOPPING & BOULEVARD KM 28.5 VALUE 450.00 CENTRAL."
To:
"ST STN SET J STORES T40 T41 TERREO SHOPPING AND BOULEVARD KM 28.5 450.00 CENTRAL"
My code:
String padrao = @"(?i)(,|.)?[^A-Za-z0-9]\s"; String padrao =
@"(?i)[^0-9a-z]\s]";
Regex rg = new Regex(_texto, " ");
var arrayTexto =
resultado.Normalize(NormalizationForm.Formd).toCharArray();
foreach(char letter in arrayTexto) { if
(CharUnicodeInfo.GetUnicodeCategory(letter) !=
UnicodeCategory.NonSpacingMark) sb.Append(letter); }
What’s wrong with it?
you want to remove
*, -
?– Marconi
Apparently that’s right, um
replace
will solve.– Ismael
@Ishmael well thought out.
– Marconi
That! , remove special characters, point, ecomercial and wherever KM is and keep the comma and point values.
– hard123
@Adrianosuv already tried with Replace?
– Marconi
Replace will be very complex because I have to eliminate all special characters and accents and preserve the point and comma where values and kiosk.
– hard123
If I can get the Dot and preserve the Comma of this address AV D.R MAURO L MONTEIRO KM 28,5 com Regex the rest I can make a Replace native to the csharp.
– hard123