简体   繁体   English

使用Java从单词列表中检索选定的字符串

[英]Retrieve selected strings from a list of words using Java

I would like to know are there any way to retrieve selected words from a string. 我想知道有什么方法可以从字符串中检索选定的单词。 Example I would like to retrieve the bold words from my textfile. 示例我想从我的文本文件中检索粗体字。

Below is the list of words which i would like to retrieve: 以下是我想检索的单词列表:

Item [ 00001 : Chemical Engineering by RC Lodeen : on loan to borrower 001: Mr X (41, NX4 4XZ)] borrowed by [ 001 : Mr X (41, NX4 4XZ)]; 项目[ 00001RC Lodeen的 化学工程 :借给借款人001:[ 001X先生(41,NX4 4XZ)]借给X先生 (41,NX4 4XZ)]; timestamp 1418119171904 时间戳记1418119171904

I have tried searching on google but the solution which they provide didnt help me. 我曾尝试在Google上进行搜索,但是他们提供的解决方案并没有帮助我。 Can anyone guide me on how to solve this problem. 谁能指导我如何解决这个问题。

You will need to define a set of criteria in order to determine which words you want to retrieve, such as "Retrieve all characters that follow a '[' symbol until a ':' is found". 您将需要定义一组条件以确定要检索的单词,例如“检索在'['符号后的所有字符,直到找到':'”。 After you have defined such a set, use regular expressions to select your words. 定义了这样的集合后,请使用正则表达式选择单词。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM