如何使用模式匹配从文件中提取字符串 [英] how to extract a string from a file using pattern matching

查看:76
本文介绍了如何使用模式匹配从文件中提取字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含国家名称和其他名称的文件。我使用模式匹配提取国家名称

ex-USA

INDIA

英国

WILSON

名称

TRIATHY



i必须只提取国家像印度英国这样的名字..喜欢这个。可以任何人给予理智吗?

I have a file containing country name and also other name.Hw i extract country name using pattern matching
ex-USA
INDIA
UK
WILSON
NAME
TRIATHY

i have to only extract country name like INDIA UK ..like this .Can anybody giv som idea??

推荐答案

这可以帮到你:



http://msdn.microsoft.com/en-us/library/vstudio/ ms228595.aspx [ ^ ]



但您必须根据要求决定自己的正则表达式。
This could help you:

http://msdn.microsoft.com/en-us/library/vstudio/ms228595.aspx[^]

But you will have to decide on your own regular expressions based on the requirements.


这篇关于如何使用模式匹配从文件中提取字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆