Please suggest a regular expression to capture this 开发者_如何学编程from the input text below:
Match 0:"Modifications made by ... on2011/07/13 06:17:32 from database
keyword: zzzz--> mmmmmm
total_effort: --> 0.00
tmp__effort: --> 0
resolver"
Match 1:"Modifications made by ... on2011/07/13 06:19:32 from database
resolver"
Input text:
Modifications made by... on 2011/06/21 14:09:14 from database
problem_description: (text value has changed)
Modifications made by ... on2011/07/13 06:17:32 from database
keyword: zzzz--> mmmmmm
total_effort: --> 0.00
tmp__effort: --> 0
resolver: y --> x
total_t_effort: --> 0.00
Modifications made by ... on2011/07/13 06:19:32 from database
resolver: x --> z
total_t_effort: --> 0.00
I've tried using this modifications\smade\sby(.|\n)+?resolver
but it gives me incorrect output:
Match 0:"Modifications made by... on 2011/06/21 14:09:14 from database
problem_description: (text value has changed)
Modifications made by ... on2011/07/13 06:17:32 from database
keyword: zzzz--> mmmmmm
total_effort: --> 0.00
tmp__effort: --> 0
resolver"
Match 1:"Modifications made by ... on2011/07/13 06:19:32 from database
resolver"
Options used: IgnoreCase + MultiLine
Can anyone help please?
Thanks!
If you want to use regex for this it gets a bit more complicated.
Try
^modifications\smade\sby(.(?!modifications))+?resolver
See it here on Regexr
I removed the \n
and used the Singleline option instead.
The idea is, match every character till the next "resolver", but only when this character is not followed by "modifications". Therefore I used the negative lookahead .(?!modifications)
.
精彩评论