从我从文件中读取的字符串中提取名称 [英] exttracting the name from the string which i read from file
本文介绍了从我从文件中读取的字符串中提取名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从文件中读取以下行
I read the following line from a file
展开 | 选择 | Wrap | 行号
推荐答案
阅读模式和匹配类的API文档。
使用正则表达式\\>编译模式([^] ;] +)\\<"并且匹配
组1开始和结束边界。
亲切的问候,
Jos
Read the API documentation for the Pattern and Matcher classes.
Compile a Pattern with the regular expression "\\>([^>]+)\\<" and match for
group 1 start and end boundaries.
kind regards,
Jos
我从文件中读取以下行
I read the following line from a file
展开 | 选择 | Wrap < span class =codeDivider> | 行号
我删除了你的其他相同的线程。我还给了你解决你的
问题的解决方案:根据我向你展示的正则表达式创建一个模式;有模式
创建一个Matcher并找到组#1的start()和end |()边界。
所有你需要做的就是现在阅读API文档。
亲切的问候,
Jos(主持人)
Hi, I removed your other identical thread. I also gave you the solution to your
problem: create a Pattern given the regexp I showed you; have the Pattern
create a Matcher and find the start() and end|() boundaries of group #1.
All you have to do is read the API documentation now.
kind regards,
Jos (moderator)
这篇关于从我从文件中读取的字符串中提取名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文