.Net / SQL Server / Powershell-从Word Doc中提取关键字/值

时间:2018-07-13 10:07:22

标签: .net sql-server powershell

使用.Net,我们需要搜索Word文档以及所搜索关键字的其他必需值。请参阅下面的示例,请作为.Net的新手提供帮助

源文档(Word文档有将近300页需要搜索的页面):

"Margin" means:
(a) in relation to any Facility A Loan [2% ] per cent. per annum;
(b) in relation to any Facility B Loan [ 5% ] per cent. per annum;
(c) in relation to any Facility C Loan [ 10% ] per cent. per annum;

Search for following in doc:
Facility A Loan (under Margins section)
Facility B Loan (under Margins section)
Facility C Loan (under Margins section)

Output Required (values within bracket to be extracted):
2%
5%
10%

1 个答案:

答案 0 :(得分:0)

您需要做两件事-

  1. 解析文档-

要完成此操作,请使用此链接作为参考-C#: How to (parse the text content)/ read from Microsoft Word Document doc

  1. 捕获文本

使用以下正则表达式-

\[(.*?)\]

有关更多信息,请访问此网站-Regular Expression in C#