How to do a "find and replace" with Regex capturing groups.

%3CLINGO-SUB%20id%3D%22%5C%26quot%3Blingo-sub-3154224%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3EHow%20to%20do%20a%20%22find%20and%20replace%22%20with%20Regex%20capturing%20groups.%26lt%3B%5C%2Flingo-sub%26gt%3B%3CLINGO-BODY%20id%3D%22%5C%26quot%3Blingo-body-3154224%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CP%3EWord%20in%20Office%20365%20on%20Windows%2010%20---%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EI%20need%20to%20replace%20all%20single-line%20occurrences%20of%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3BABC%26nbsp%3B%20...anything...%26nbsp%3B%20DEF%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3Ewith%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3BXYZ%26nbsp%3B%20...anything...%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3Ewhere%26nbsp%3B%20...anything...%26nbsp%3B%20can%20be%20anything%20other%20than%20DEF.%26nbsp%3B%20%26nbsp%3BI%20can%20easily%20use%20a%20REGEX%20to%20do%20the%20match%20but%20how%20can%20I%20specify%20whatever%20...anything...%20happens%20to%20be%20in%20the%20replace%20string%3F%26nbsp%3B%20I%20know%20that%20REGEX%20supports%20capturing%20groups%20but%20how%20do%20I%20specify%20them%20in%20the%20replacement%20string%3F%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EThanks%20%3A)%26lt%3B%5C%2Fimg%26gt%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%26lt%3B%5C%2Flingo-body%26gt%3B%3CLINGO-LABS%20id%3D%22%5C%26quot%3Blingo-labs-3154224%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CLINGO-LABEL%3EOffice%20365%26lt%3B%5C%2Flingo-label%26gt%3B%3CLINGO-LABEL%3EWord%26lt%3B%5C%2Flingo-label%26gt%3B%26lt%3B%5C%2Flingo-labs%26gt%3B%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3C%2FLINGO-SUB%3E
New Contributor

Word in Office 365 on Windows 10 ---

I need to replace all single-line occurrences of

   ABC  ...anything...  DEF

with

   XYZ  ...anything...

where  ...anything...  can be anything other than DEF.   I can easily use a REGEX to do the match but how can I specify whatever ...anything... happens to be in the replacement string?  I know that REGEX supports capturing groups how do I specify them in the replacement string?

Thanks :)

 

0 Replies