正则表达式匹配给定文本中某些文本的所有副本(文本中没有空格\单词,文本是一行)

时间:2017-06-16 11:48:28

标签: java regex

什么正则表达式匹配以下输出中origModifiedTime的所有出现次数?

此输出是单行(行尾符号位于最后),没有空格(单词)。它是ArrayList的输出(log),包含一些类的几个实例。我需要在所有这些实例中看到某个字段的值。

我需要这个正则表达式在控制台输出中突出显示这些单词(使用GrepConsole eclipse插件,它承诺突出显示正则表达式匹配的部分)。

  

[model.AudioRecord@622ebecd [ID = 7,重要性= MID,cramFlag =假,topicGroup = IT,主题=爪哇,副题=,注释=,searchTags =,chekoutDate =,nextReviewDate =,reviewHistory =,trackedName = 812_1206_200.WMA,origName = 812_1206,origModifiedTime = 2017-06-15T19:22:16,档案大小= 838408],   model.AudioRecord@2d12e7d2 [ID = 6,重视= MID,cramFlag =假,topicGroup = IT,话题=的Java,副标题=,注释=,= searchTags,chekoutDate =,= nextReviewDate,reviewHistory =,= trackedName 812_1210_580.WMA, origName = 812_1210,origModifiedTime = 2017-06-13T21:51:38,档案大小= 1172952],   model.AudioRecord@3e363ecc [ID = 5,重视= MID,cramFlag =假,topicGroup = IT,话题=的Java,副标题=,注释=,= searchTags,chekoutDate =,= nextReviewDate,reviewHistory =,= trackedName 812_1210.WMA, origName = 812_1210,origModifiedTime = 2017-01-17T20:09:48,档案大小= 1172952],   model.AudioRecord@29f93711 [ID = 4,重视= MID,cramFlag =假,topicGroup = IT,话题=的Java,副标题=,注释=,= searchTags,chekoutDate =,= nextReviewDate,reviewHistory =,= trackedName 812_1209.WMA, origName = 812_1209,origModifiedTime = 2017-01-17T18:15:50,档案大小= 2720218],   model.AudioRecord@5faad73e [ID = 3,重要性= MID,cramFlag =假,topicGroup = IT,话题=的Java,副标题=,注释=,= searchTags,chekoutDate =,= nextReviewDate,reviewHistory =,= trackedName 812_1208.WMA, origName = 812_1208,origModifiedTime = 2017-01-16T23:45:42,档案大小= 12320436],   model.AudioRecord@653c876e [ID = 2,重要性= MID,cramFlag =假,topicGroup = IT,话题=的Java,副标题=,注释=,= searchTags,chekoutDate =,= nextReviewDate,reviewHistory =,= trackedName 812_1207.WMA, origName = 812_1207,origModifiedTime = 2017-01-15T02:54:26,档案大小= 3831382],   model.AudioRecord@6a73055b [ID = 1,重视= MID,cramFlag =假,topicGroup = IT,话题=的Java,副标题=,注释=,= searchTags,chekoutDate =,= nextReviewDate,reviewHistory =,= trackedName 812_1206.WMA, origName = 812_1206,origModifiedTime = 2017-01-15T00:22:34,档案大小= 838408]]

1 个答案:

答案 0 :(得分:0)

试试这个:

(?<=origModifiedTime)(.*)(?=,)/gU

它使用正面的lookbehind和正向前瞻来匹配某两个字符之间的任何内容。

enter image description here

https://regex101.com/r/re6Tfi/1