0
c를 정규식을 사용하여 텍스트의 일부를 대체 : 방법, 예를 들어 #
string str = [email protected]"<html> <head> </ head > <body> <start> <h1> Header 1 </ h1 > <p> A worker can be of 3 different types.</ p > <end> <p></ p > </ body > </ html > "
string replacement = "hello world";
string newString = [email protected]"<html> <head> </ head > <body> <start> <h1> Header 1 </ h1 > <p> hello world</ p > <end> <p></ p > </ body > </ html > "
그래서 내가 교체해야 할 텍스트의 일부 알아야 할
<start>
및
<end>
기호가 있습니다. 정규식으로
newString
을 얻는 방법.
이 정규식 너무 간단합니다. 보다 효율적인 String.Replace() 메소드를 사용하십시오. – jdweng
답변을 주셔서 감사하지만 도움이되지 않았습니다. –
@DoniyorNiyozov - "도움을받지 못했다"는 것은 무엇을 의미합니까? 그것은 나를 위해 작동합니다. 어떤 C#을 사용하고 있습니까? C# 6.0 이하인 경우 업데이트 –