// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r"(?m)\{\{.+Company_Name.+\}\}").unwrap();
let string = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
<w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:cx=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" xmlns:cx1=\"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex\" xmlns:cx2=\"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex\" xmlns:cx3=\"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex\" xmlns:cx4=\"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex\" xmlns:cx5=\"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex\" xmlns:cx6=\"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex\" xmlns:cx7=\"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex\" xmlns:cx8=\"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:aink=\"http://schemas.microsoft.com/office/drawing/2016/ink\" xmlns:am3d=\"http://schemas.microsoft.com/office/drawing/2017/model3d\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:oel=\"http://schemas.microsoft.com/office/2019/extlst\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:w16cex=\"http://schemas.microsoft.com/office/word/2018/wordml/cex\" xmlns:w16cid=\"http://schemas.microsoft.com/office/word/2016/wordml/cid\" xmlns:w16=\"http://schemas.microsoft.com/office/word/2018/wordml\" xmlns:w16sdtdh=\"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash\" xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14\"><w:body><w:p w14:paraId=\"1599AF6E\" w14:textId=\"34AAE6AB\" w:rsidR=\"00F64201\" w:rsidRDefault=\"00B721B4\" w:rsidP=\"00B721B4\"><w:pPr><w:pStyle w:val=\"Heading1\"/></w:pPr><w:r><w:t>{{</w:t></w:r><w:proofErr w:type=\"spellStart\"/><w:r><w:t>Company_Name</w:t></w:r><w:proofErr w:type=\"spellEnd\"/><w:r><w:t>}} {{APP}} Account Data</w:t></w:r></w:p><w:p w14:paraId=\"278C6776\" w14:textId=\"1B6000C5\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"/><w:tbl><w:tblPr><w:tblStyle w:val=\"TableGrid\"/><w:tblW w:w=\"0\" w:type=\"auto\"/><w:tblLook w:val=\"04A0\" w:firstRow=\"1\" w:lastRow=\"0\" w:firstColumn=\"1\" w:lastColumn=\"0\" w:noHBand=\"0\" w:noVBand=\"1\"/></w:tblPr><w:tblGrid><w:gridCol w:w=\"1870\"/><w:gridCol w:w=\"1870\"/><w:gridCol w:w=\"1870\"/><w:gridCol w:w=\"1870\"/><w:gridCol w:w=\"1870\"/></w:tblGrid><w:tr w:rsidR=\"00B721B4\" w14:paraId=\"100413BB\" w14:textId=\"77777777\" w:rsidTr=\"00B721B4\"><w:tc><w:tcPr><w:tcW w:w=\"1870\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"5FD7C610\" w14:textId=\"015F6641\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"><w:r><w:t>Name</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1870\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"73D639A3\" w14:textId=\"0258323E\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"><w:proofErr w:type=\"spellStart\"/><w:r><w:t>CreateDate</w:t></w:r><w:proofErr w:type=\"spellEnd\"/></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1870\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"7C6E1CA5\" w14:textId=\"4B5E3085\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"><w:r><w:t>VIP</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1870\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"274DDEA7\" w14:textId=\"516124C5\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"><w:r><w:t>Points</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1870\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"7163781E\" w14:textId=\"460DA08B\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"><w:r><w:t>Remark</w:t></w:r></w:p></w:tc></w:tr><w:tr w:rsidR=\"00B721B4\" w14:paraId=\"35A728A6\" w14:textId=\"77777777\" w:rsidTr=\"00B721B4\"><w:tc><w:tcPr><w:tcW w:w=\"1870\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"0775B817\" w14:textId=\"17DA096B\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"><w:r><w:t>{{Name}}</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1870\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"4A2404F3\" w14:textId=\"6CC57F74\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"><w:r><w:t>{{</w:t></w:r><w:proofErr w:type=\"spellStart\"/><w:r><w:t>CreateDate</w:t></w:r><w:proofErr w:type=\"spellEnd\"/><w:r><w:t>}}</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1870\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"62DEB9C3\" w14:textId=\"618125BB\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"><w:r><w:t>{{VIP}}</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1870\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"158965BA\" w14:textId=\"1EA5CD08\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"><w:r><w:t>{{Points}}</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1870\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"53105C06\" w14:textId=\"07109D26\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"><w:r><w:t xml:space=\"preserve\">{{Name}} has </w:t></w:r><w:r w:rsidRPr=\"005F3C0A\"><w:rPr><w:color w:val=\"FF0000\"/></w:rPr><w:t xml:space=\"preserve\">{{Points}} </w:t></w:r><w:r><w:t>points</w:t></w:r></w:p></w:tc></w:tr></w:tbl><w:p w14:paraId=\"671D355C\" w14:textId=\"77777777\" w:rsidR=\"00B721B4\" w:rsidRDefault=\"00B721B4\"/><w:sectPr w:rsidR=\"00B721B4\"><w:pgSz w:w=\"12240\" w:h=\"15840\"/><w:pgMar w:top=\"1440\" w:right=\"1440\" w:bottom=\"1440\" w:left=\"1440\" w:header=\"720\" w:footer=\"720\" w:gutter=\"0\"/><w:cols w:space=\"720\"/><w:docGrid w:linePitch=\"360\"/></w:sectPr></w:body></w:document>";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Rust, please visit: https://docs.rs/regex/latest/regex/