Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Apr 04, 2025 9:12 am

document.Replace(r"B\.\s+\w+", r"\nB. ....", False, True)
how do i replace with some regular expression
for example i have a piece of answer like this:
A. Content A. B. Content B. C. Content C. D. Content D.
i just want to break line at each position A,B,C,D with a period and space add a certain content after it

ntuan310203
 
Posts: 2
Joined: Wed Mar 12, 2025 5:50 am

Mon Apr 07, 2025 6:41 am

Hello,

Thanks for your inquiry.
Please refer to the following tutorial to achieve the need to replace text through regular expressions. If you have any other questions, please feel free to write back.
Find and Replace Text by Regular Expressions in Word in C#, VB.NET

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 657
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.Doc