我想要一种从XML字符串中捕获所有无效XML字符的简单方法。 sol,far我找不到任何捕获XML中所有无效字符的东西。 我使用的是.Net 4.0,这是我的字符串。
string abc = @"<Attribute key=""History"" value="" ....................................................
3/4/2016 7:09:29 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (ME Review)
Description: created/confirmed datasheet & parameters in library datasheet folder 
\share1\PLATFORM_DESIGN\Hardware_Design\Library_Datasheets\ic\REQ42373


....................................................
3/4/2016 6:39:27 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (ME Review)
Description: READY FOR MFG ENG review

PASED LIBRARY review
deleted un-used PROPERTIES (CLIP_DRAWING)
confirmed DFA_DEV_CLASS = SUB50
PHYSICAL checked: 
confirmed DRAWING LOCKED = TRUE
Is the body size at least as big as the maximum body size on the datasheet? yes (2.9x3.15)
Are the pins numbered correctly according to the datasheet? yes 
Is the pitch of the symbol the same as the pitch of the part ? yes (datasheet = 0.65)
Is the width of the pad at least the same width of the max lead? yes 
Is pin 1 identified in silkscreen? yes (circles, plus assembly top circle)
Is there a placebound top shape extending .1MM from body edge? yes 
Is the height correctly indicated in the placebound top shape? yes 1.3mm
Is the ref des correct for symbol type (parts with center die pad use EU)? yes -- U* 
Is there a solid shape matching body outline in Package_Geometry, Dfa_Bound_Top, plus pins? yes 
Does the symbol have a DFA_Class assigned? yes-- DFA_DEV_CLASS = SUB50 
Pitch <50 mils 
Is the symbol toe to toe at least 50 mils greater than the part toe to toe rounded to the nearest 10 mils? 
4.25mm + 1.27 (50 mil) = 5.52mmm --- 5.53 on symbol 
Is the symbol heel to heel at least 30 mils less than the part heel to heel or 10 mils less than part min body (whichever is greater) rounded down to the nearest 10 mils? 
Heel-to-heel 1.788 (70 mil) or 2.446 (98mil) compared to 2.285mm (90mil) on symbol 
Has the lock property been applied to the symbol? yes



....................................................
3/4/2016 6:17:09 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: added SUBCLASS "lib_rev" , added text REV1


....................................................
3/4/2016 6:16:19 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: PHYSICAL: missing LIB_REV subclass


....................................................
3/4/2016 6:10:56 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: Schematic symbol: 
Does the symbol pinout match package specified by DE? yes (DCT package for SSOP)
Is the correct IPN/REQ# for the part in the part properties? Yes (PTF entry: placeholder REQ42373)
Does the symbol have BOM, Device, Finance, IPN, Lead Free, MFR, MFR P/N, PART_NUMBER, ROOM and NO_STUFF properties in the part properties? yes (known exception: no BOM, LEAD FREE, FINANCE property)
Do all the properties in the symbol match the datasheet and/or SPEED? yes: match datasheet (DCT package for SSOP) 
Is the ref des correct for the part type? yes: U* 
Is the correct mechanical symbol in PTF entry? yes: PTF entry w\new PHYSICAL: sSOP8_P65MM_2P8X2P95_1P3H
Has the pin organization been okayed by the DE? yes: matches typical in datasheet 
Are all the pins on grid? yes 
Does the symbol package? yes: packaged successfully 
Has the symbol been double-checked after a 24hr waiting period? (Or a second person double-checked the symbol?) 
peer reviewed 




....................................................
3/4/2016 4:55:29 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: peer review:
LOGICAL : removed V from pin text (inside body) for NC pin 7


....................................................
3/4/2016 4:54:07 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (DE Review)
Description: placeholder Part Number
verbal approval by Jim Yoder for LOGICAL symbol
  	
 


....................................................
3/4/2016 11:11:03 AM U.S. AZ (UTC/GMT -7), MAGALLANES, J. L: (Pending Validation) (Stakeholder(s) Review)
Description: Ready for DE, ME and Peer review.
Schematic symbol:
1	Does the symbol pinout match package specified by DE?	Yes
2	Is the correct IPN/REQ# for the part in the part properties?	Yes
3	Does the symbol have BOM, Device, Finance, IPN, Lead Free, MFR, MFR P/N, PART_NUMBER, ROOM and NO_STUFF properties in the part properties?	Yes
4	Do all the properties in the symbol match the datasheet and/or SPEED?	Yes
5	Is the ref des correct for the part type?	Yes
6	Is the correct mechanical symbol in the package properties?	Yes
7	Has the pin organization been okayed by the DE?	No
8	Are all the pins on grid?	Yes
9	Does the symbol package?	Yes
10	Has the symbol been double-checked after a 24hr waiting period? (Or a second person double-checked the symbol?)	No
Footprint:
1	Is the body size at least as big as the maximum body size on the datasheet?	Yes
2	Are the pins numbered correctly according to the datasheet?	Yes
3	Is the pitch of the symbol the same as the pitch of the part?	Yes
4	Is the width of the pad at least the same width of the max lead?	Yes
5	Is pin 1 identified in silkscreen?	Yes
6	Is there a placebound top shape extending .1MM from body edge?	Yes
7	Is the height correctly indicated in the placebound top shape?	
8	Is the ref des correct for symbol type (parts with center die pad use EU)?	Yes
9	Is there a solid shape matching body outline in Package_Geometry, Dfa_Bound_Top, plus pins?	Yes
10	Does the symbol have a DFA_Class assigned?	Yes
11	Pitch <50 mils	Yes
12	Is the symbol toe to toe at least 50 mils greater than the part toe to toe rounded to the nearest 10 mils?	Yes
13	Is the symbol heel to heel at least 30 mils less than the part heel to heel or 10 mils less than part min body (whichever is greater) rounded down to the nearest 10 mils?	Yes
15	Pitch >50 mils	N/A
16	Is the symbol toe to toe at least 30 mils greater than the part toe to toe rounded to the nearest 10 mils?	N/A
17	Is the symbol heel to heel at least 30 mils less than the part heel to heel or 10 mils less than part min body (whichever is greater) rounded down to the nearest 10 mils?	N/A
19	Pitch with <.165 MM airgap	N/A
20	Is there soldermask clearance equaling metal pattern plus gaps between adjacent pads?	N/A
21	Is there route keepout top where there is soldermask clearance between adjacent pins?	N/A
22	Has the lock property been applied to the symbol?	Yes



....................................................
3/2/2016 5:50:51 PM U.S. AZ (UTC/GMT -7), MAGALLANES, J. L: (Active) (In Process)
Description: Names added for Schematic symbol and Footprint.


....................................................
3/2/2016 5:39:32 PM U.S. AZ (UTC/GMT -7), MAGALLANES, J. L: (Active) (In Process)
Description: In Process of creation.


....................................................
2/22/2016 3:55:00 PM U.S. AZ (UTC/GMT -7), YODER, JIM : (New) (New)
Description: new symbols

Attached file: TI ts5a2053""/>";
我正在使用以下代码
var xmlPattern = "[^\u0001-\uD7FF\uE000-\uFFFD\ud800\udc00-\udbff\udfff]";
var newXml = xml.replace(new RegExp(xmlPattern , "g"), "");
但它没有抓住 
我检查了here,here但没人帮忙。 编辑:- 这是完整的程序
using System;
using System.Collections.Generic;
using System.Net.Mail;
using System.Globalization;
using System.Xml.Linq;
using System.Text.RegularExpressions;
using System.Text;
using System.Xml;
using System.Net;
class Program
{
static void Main()
{
string abc = @"<Attribute key=""History"" value="" ....................................................
3/4/2016 7:09:29 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (ME Review)
Description: created/confirmed datasheet & parameters in library datasheet folder 
\share1\PLATFORM_DESIGN\Hardware_Design\Library_Datasheets\ic\REQ42373


....................................................
3/4/2016 6:39:27 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (ME Review)
Description: READY FOR MFG ENG review

PASED LIBRARY review
deleted un-used PROPERTIES (CLIP_DRAWING)
confirmed DFA_DEV_CLASS = SUB50
PHYSICAL checked: 
confirmed DRAWING LOCKED = TRUE
Is the body size at least as big as the maximum body size on the datasheet? yes (2.9x3.15)
Are the pins numbered correctly according to the datasheet? yes 
Is the pitch of the symbol the same as the pitch of the part ? yes (datasheet = 0.65)
Is the width of the pad at least the same width of the max lead? yes 
Is pin 1 identified in silkscreen? yes (circles, plus assembly top circle)
Is there a placebound top shape extending .1MM from body edge? yes 
Is the height correctly indicated in the placebound top shape? yes 1.3mm
Is the ref des correct for symbol type (parts with center die pad use EU)? yes -- U* 
Is there a solid shape matching body outline in Package_Geometry, Dfa_Bound_Top, plus pins? yes 
Does the symbol have a DFA_Class assigned? yes-- DFA_DEV_CLASS = SUB50 
Pitch <50 mils 
Is the symbol toe to toe at least 50 mils greater than the part toe to toe rounded to the nearest 10 mils? 
4.25mm + 1.27 (50 mil) = 5.52mmm --- 5.53 on symbol 
Is the symbol heel to heel at least 30 mils less than the part heel to heel or 10 mils less than part min body (whichever is greater) rounded down to the nearest 10 mils? 
Heel-to-heel 1.788 (70 mil) or 2.446 (98mil) compared to 2.285mm (90mil) on symbol 
Has the lock property been applied to the symbol? yes



....................................................
3/4/2016 6:17:09 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: added SUBCLASS "lib_rev" , added text REV1


....................................................
3/4/2016 6:16:19 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: PHYSICAL: missing LIB_REV subclass


....................................................
3/4/2016 6:10:56 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: Schematic symbol: 
Does the symbol pinout match package specified by DE? yes (DCT package for SSOP)
Is the correct IPN/REQ# for the part in the part properties? Yes (PTF entry: placeholder REQ42373)
Does the symbol have BOM, Device, Finance, IPN, Lead Free, MFR, MFR P/N, PART_NUMBER, ROOM and NO_STUFF properties in the part properties? yes (known exception: no BOM, LEAD FREE, FINANCE property)
Do all the properties in the symbol match the datasheet and/or SPEED? yes: match datasheet (DCT package for SSOP) 
Is the ref des correct for the part type? yes: U* 
Is the correct mechanical symbol in PTF entry? yes: PTF entry w\new PHYSICAL: sSOP8_P65MM_2P8X2P95_1P3H
Has the pin organization been okayed by the DE? yes: matches typical in datasheet 
Are all the pins on grid? yes 
Does the symbol package? yes: packaged successfully 
Has the symbol been double-checked after a 24hr waiting period? (Or a second person double-checked the symbol?) 
peer reviewed 




....................................................
3/4/2016 4:55:29 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: peer review:
LOGICAL : removed V from pin text (inside body) for NC pin 7


....................................................
3/4/2016 4:54:07 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (DE Review)
Description: placeholder Part Number
verbal approval by Jim Yoder for LOGICAL symbol
  	
 


....................................................
3/4/2016 11:11:03 AM U.S. AZ (UTC/GMT -7), MAGALLANES, J. L: (Pending Validation) (Stakeholder(s) Review)
Description: Ready for DE, ME and Peer review.
Schematic symbol:
1	Does the symbol pinout match package specified by DE?	Yes
2	Is the correct IPN/REQ# for the part in the part properties?	Yes
3	Does the symbol have BOM, Device, Finance, IPN, Lead Free, MFR, MFR P/N, PART_NUMBER, ROOM and NO_STUFF properties in the part properties?	Yes
4	Do all the properties in the symbol match the datasheet and/or SPEED?	Yes
5	Is the ref des correct for the part type?	Yes
6	Is the correct mechanical symbol in the package properties?	Yes
7	Has the pin organization been okayed by the DE?	No
8	Are all the pins on grid?	Yes
9	Does the symbol package?	Yes
10	Has the symbol been double-checked after a 24hr waiting period? (Or a second person double-checked the symbol?)	No
Footprint:
1	Is the body size at least as big as the maximum body size on the datasheet?	Yes
2	Are the pins numbered correctly according to the datasheet?	Yes
3	Is the pitch of the symbol the same as the pitch of the part?	Yes
4	Is the width of the pad at least the same width of the max lead?	Yes
5	Is pin 1 identified in silkscreen?	Yes
6	Is there a placebound top shape extending .1MM from body edge?	Yes
7	Is the height correctly indicated in the placebound top shape?	
8	Is the ref des correct for symbol type (parts with center die pad use EU)?	Yes
9	Is there a solid shape matching body outline in Package_Geometry, Dfa_Bound_Top, plus pins?	Yes
10	Does the symbol have a DFA_Class assigned?	Yes
11	Pitch <50 mils	Yes
12	Is the symbol toe to toe at least 50 mils greater than the part toe to toe rounded to the nearest 10 mils?	Yes
13	Is the symbol heel to heel at least 30 mils less than the part heel to heel or 10 mils less than part min body (whichever is greater) rounded down to the nearest 10 mils?	Yes
15	Pitch >50 mils	N/A
16	Is the symbol toe to toe at least 30 mils greater than the part toe to toe rounded to the nearest 10 mils?	N/A
17	Is the symbol heel to heel at least 30 mils less than the part heel to heel or 10 mils less than part min body (whichever is greater) rounded down to the nearest 10 mils?	N/A
19	Pitch with <.165 MM airgap	N/A
20	Is there soldermask clearance equaling metal pattern plus gaps between adjacent pads?	N/A
21	Is there route keepout top where there is soldermask clearance between adjacent pins?	N/A
22	Has the lock property been applied to the symbol?	Yes



....................................................
3/2/2016 5:50:51 PM U.S. AZ (UTC/GMT -7), MAGALLANES, J. L: (Active) (In Process)
Description: Names added for Schematic symbol and Footprint.


....................................................
3/2/2016 5:39:32 PM U.S. AZ (UTC/GMT -7), MAGALLANES, J. L: (Active) (In Process)
Description: In Process of creation.


....................................................
2/22/2016 3:55:00 PM U.S. AZ (UTC/GMT -7), YODER, JIM : (New) (New)
Description: new symbols

Attached file: TI ts5a2053""/>";
CleanInvalidXmlChars(abc);
Console.WriteLine(XElement.Parse(abc));
}
public static string CleanInvalidXmlChars(string text)
{
string Pattern=@"#x((10?|[2-F])FFF[EF]|FDD[0-9A-F]|7F|8[0-46-9A-F]9[0-9A-F])";
string newString = string.Empty;
Regex regex = new Regex(Pattern, RegexOptions.IgnoreCase);
if (regex.IsMatch(text))
newString=regex.Replace(text, "");
return newString.ToString();
}
}
答案 0 :(得分:0)
不要替换它们 - 使用CDATA-Section
允许它们
CDATA-Section MSDN
答案 1 :(得分:0)
对于初学者,请注意您的函数CleanInvalidXmlChars()会返回一个新字符串,但您没有对此字符串执行任何操作。此外,xml版本可能是1.1,因此它需要不同的字符过滤器。请试试这段代码......
static void Main()
{
string abc = @"<Attribute key=""History"" value="" ....................................................
3/4/2016 7:09:29 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (ME Review)
Description: created/confirmed datasheet & parameters in library datasheet folder 
\share1\PLATFORM_DESIGN\Hardware_Design\Library_Datasheets\ic\REQ42373


....................................................
3/4/2016 6:39:27 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (ME Review)
Description: READY FOR MFG ENG review

PASED LIBRARY review
deleted un-used PROPERTIES (CLIP_DRAWING)
confirmed DFA_DEV_CLASS = SUB50
PHYSICAL checked: 
confirmed DRAWING LOCKED = TRUE
Is the body size at least as big as the maximum body size on the datasheet? yes (2.9x3.15)
Are the pins numbered correctly according to the datasheet? yes 
Is the pitch of the symbol the same as the pitch of the part ? yes (datasheet = 0.65)
Is the width of the pad at least the same width of the max lead? yes 
Is pin 1 identified in silkscreen? yes (circles, plus assembly top circle)
Is there a placebound top shape extending .1MM from body edge? yes 
Is the height correctly indicated in the placebound top shape? yes 1.3mm
Is the ref des correct for symbol type (parts with center die pad use EU)? yes -- U* 
Is there a solid shape matching body outline in Package_Geometry, Dfa_Bound_Top, plus pins? yes 
Does the symbol have a DFA_Class assigned? yes-- DFA_DEV_CLASS = SUB50 
Pitch <50 mils 
Is the symbol toe to toe at least 50 mils greater than the part toe to toe rounded to the nearest 10 mils? 
4.25mm + 1.27 (50 mil) = 5.52mmm --- 5.53 on symbol 
Is the symbol heel to heel at least 30 mils less than the part heel to heel or 10 mils less than part min body (whichever is greater) rounded down to the nearest 10 mils? 
Heel-to-heel 1.788 (70 mil) or 2.446 (98mil) compared to 2.285mm (90mil) on symbol 
Has the lock property been applied to the symbol? yes



....................................................
3/4/2016 6:17:09 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: added SUBCLASS "lib_rev" , added text REV1


....................................................
3/4/2016 6:16:19 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: PHYSICAL: missing LIB_REV subclass


....................................................
3/4/2016 6:10:56 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: Schematic symbol: 
Does the symbol pinout match package specified by DE? yes (DCT package for SSOP)
Is the correct IPN/REQ# for the part in the part properties? Yes (PTF entry: placeholder REQ42373)
Does the symbol have BOM, Device, Finance, IPN, Lead Free, MFR, MFR P/N, PART_NUMBER, ROOM and NO_STUFF properties in the part properties? yes (known exception: no BOM, LEAD FREE, FINANCE property)
Do all the properties in the symbol match the datasheet and/or SPEED? yes: match datasheet (DCT package for SSOP) 
Is the ref des correct for the part type? yes: U* 
Is the correct mechanical symbol in PTF entry? yes: PTF entry w\new PHYSICAL: sSOP8_P65MM_2P8X2P95_1P3H
Has the pin organization been okayed by the DE? yes: matches typical in datasheet 
Are all the pins on grid? yes 
Does the symbol package? yes: packaged successfully 
Has the symbol been double-checked after a 24hr waiting period? (Or a second person double-checked the symbol?) 
peer reviewed 




....................................................
3/4/2016 4:55:29 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (Library Review)
Description: peer review:
LOGICAL : removed V from pin text (inside body) for NC pin 7


....................................................
3/4/2016 4:54:07 PM U.S. AZ (UTC/GMT -7), MEADORS, CY I: (Pending Validation) (DE Review)
Description: placeholder Part Number
verbal approval by Jim Yoder for LOGICAL symbol
  	
 


....................................................
3/4/2016 11:11:03 AM U.S. AZ (UTC/GMT -7), MAGALLANES, J. L: (Pending Validation) (Stakeholder(s) Review)
Description: Ready for DE, ME and Peer review.
Schematic symbol:
1	Does the symbol pinout match package specified by DE?	Yes
2	Is the correct IPN/REQ# for the part in the part properties?	Yes
3	Does the symbol have BOM, Device, Finance, IPN, Lead Free, MFR, MFR P/N, PART_NUMBER, ROOM and NO_STUFF properties in the part properties?	Yes
4	Do all the properties in the symbol match the datasheet and/or SPEED?	Yes
5	Is the ref des correct for the part type?	Yes
6	Is the correct mechanical symbol in the package properties?	Yes
7	Has the pin organization been okayed by the DE?	No
8	Are all the pins on grid?	Yes
9	Does the symbol package?	Yes
10	Has the symbol been double-checked after a 24hr waiting period? (Or a second person double-checked the symbol?)	No
Footprint:
1	Is the body size at least as big as the maximum body size on the datasheet?	Yes
2	Are the pins numbered correctly according to the datasheet?	Yes
3	Is the pitch of the symbol the same as the pitch of the part?	Yes
4	Is the width of the pad at least the same width of the max lead?	Yes
5	Is pin 1 identified in silkscreen?	Yes
6	Is there a placebound top shape extending .1MM from body edge?	Yes
7	Is the height correctly indicated in the placebound top shape?	
8	Is the ref des correct for symbol type (parts with center die pad use EU)?	Yes
9	Is there a solid shape matching body outline in Package_Geometry, Dfa_Bound_Top, plus pins?	Yes
10	Does the symbol have a DFA_Class assigned?	Yes
11	Pitch <50 mils	Yes
12	Is the symbol toe to toe at least 50 mils greater than the part toe to toe rounded to the nearest 10 mils?	Yes
13	Is the symbol heel to heel at least 30 mils less than the part heel to heel or 10 mils less than part min body (whichever is greater) rounded down to the nearest 10 mils?	Yes
15	Pitch >50 mils	N/A
16	Is the symbol toe to toe at least 30 mils greater than the part toe to toe rounded to the nearest 10 mils?	N/A
17	Is the symbol heel to heel at least 30 mils less than the part heel to heel or 10 mils less than part min body (whichever is greater) rounded down to the nearest 10 mils?	N/A
19	Pitch with <.165 MM airgap	N/A
20	Is there soldermask clearance equaling metal pattern plus gaps between adjacent pads?	N/A
21	Is there route keepout top where there is soldermask clearance between adjacent pins?	N/A
22	Has the lock property been applied to the symbol?	Yes



....................................................
3/2/2016 5:50:51 PM U.S. AZ (UTC/GMT -7), MAGALLANES, J. L: (Active) (In Process)
Description: Names added for Schematic symbol and Footprint.


....................................................
3/2/2016 5:39:32 PM U.S. AZ (UTC/GMT -7), MAGALLANES, J. L: (Active) (In Process)
Description: In Process of creation.


....................................................
2/22/2016 3:55:00 PM U.S. AZ (UTC/GMT -7), YODER, JIM : (New) (New)
Description: new symbols

Attached file: TI ts5a2053""/>";
XElement xml = ParseXml(abc);
Console.WriteLine(xml);
}
private static XElement ParseXml(string text)
{
XElement xml = null;
try
{
xml = ParseXml(text, 1.0f);
}
catch(Exception)
{
xml = ParseXml(text, 1.1f);
}
return xml;
}
private static XElement ParseXml(string text, float xmlVersion)
{
string newString = CleanInvalidXmlChars(text, xmlVersion);
return XElement.Parse(newString);
}
private static string CleanInvalidXmlChars(string text, float xmlVersion)
{
const string patternVersion1_0 = @"&#x((10?|[2-F])FFF[EF]|FDD[0-9A-F]|7F|8[0-46-9A-F]9[0-9A-F]);";
const string patternVersion1_1 = @"&#x((10?|[2-F])FFF[EF]|FDD[0-9A-F]|[19][0-9A-F]|7F|8[0-46-9A-F]|0?[1-8BCEF]);";
string Pattern = xmlVersion == 1.0f ? patternVersion1_0 : patternVersion1_1;
string newString = string.Empty;
Regex regex = new Regex(Pattern, RegexOptions.IgnoreCase);
if (regex.IsMatch(text))
newString = regex.Replace(text, "");
else
newString = text;
return newString.ToString();
}