I have document in that Lower case “x” is used in x-ray unless the word begins a sentence. eg: X-rays were included in the screening./The screening included x-rays

I have document in that Lower case “x” is used in x-ray unless the word begins a sentence. eg: X-rays were included in the screening./The screening included x-rays.

@Yuvarajshivananjappa,

Do you need to find/extract your specific data/word in the MS Excel worksheet or in the MS Word document? Please elaborate your requirements in details with sample file containing your data. Moreover share some screenshots to demonstrate your requirements. We will check and assist you to accomplish your task via Aspose APIs soon.

PS. please zip the file(s) prior attaching here.

Kindly find the below attachment.Expected_Output1.docx (12.5 KB)
Input_word_Document.docx (12.7 KB)

@Yuvarajshivananjappa,

Your query is regarding Aspose.Words API, so I am moving your thread to respective forum where one of our colleagues from Aspose.Words team will assist you soon.

Any update on this?

@Yuvarajshivananjappa You can use code like this to achieve what you need:

Document doc = new Document("C:\\Temp\\in.docx");
// Replace all occurances of 'x-ray' and 'X-ray' with lowercase 'x-ray'.
doc.Range.Replace(new Regex("[Xx]-ray"), "x-ray");
// Loop through all paragraphs and replce the beginning of paragraphs with uppercase X 'X-ray'.
foreach (Paragraph p in doc.GetChildNodes(NodeType.Paragraph, true))
    p.Range.Replace(new Regex("^x-ray"), "X-ray");

doc.Save(@"C:\Temp\out.docx");