I have word document in that Capitalize “spring” when followed by a year eg: Spring 1986/spring of 1986 (year should be dynamic) kindly help me Asap.
Input_word_Document.docx (12.2 KB)
@Yuvarajshivananjappa You can use Find and Replace feature to achieve this. For example see the following code:
Document doc = new Document(@"C:\Temp\in.docx");
FindReplaceOptions options = new FindReplaceOptions();
options.UseSubstitutions = true;
doc.Range.Replace(new Regex(@"spring((\s+of)?\s\d\d\d\d)"), "Spring$1", options);
doc.Save(@"C:\Temp\out.docx");
Please see the following article to quickly become acquainted with regular expressions:
https://www.codeproject.com/Articles/9099/The-30-Minute-Regex-Tutorial
Also, you can test your regular expressions here:
https://regex101.com/