Am 5. Mai 2016 20:17:37 MESZ, schrieb Philippe Mouawad <[email protected]>: >Hi Felix, > >1. true >2. I don't understand the problem , can you clarify for me ?
^ indicates start of line (String in our case). But the code does a match, so that is implicit. But if I see a ^ I think the regex will do a "find" instead of a "match". So as a result I think we should remove the ^. > >3. Yes we want to trap: >- Sample1 >- Sample1-success >- Sample1-failure >- Sample2 >- Sample2-success >- Sample2-failure > >Ideally not Sample2XXX-success. And not Sample123? >Do you see a better regex ? If we want to match all those, than the regex is correct. All in all, I think it would be safe to change the regex to Sample[12](?:-failure|-success)? Or, if it should be a bit more descriptive (?:Sample1|Sample2)(?:-failure|-success)? Which is mostly the same as the one in the properties file. Differences are non capture and remove indicator of start of line. Felix >Thanks > > > >On Thu, May 5, 2016 at 7:23 PM, Felix Schumacher < >[email protected]> wrote: > >> Hi all, >> >> the regex for series_filter is currently set to >> >> ((^Sample1)|(^Sample2))(-success|-failure)? >> >> in the user.properties file. >> >> The regex could be written a bit shorter as >> >> ^Sample[12](-success|-failure)? >> >> But there are still a few things to consider. >> >> 1. I don't think that we are interested in the captured groups and >> could tell the regex engine that by using (?:...) instead of (...). >> >> 2. The ^ in front of Sample1 makes it look like the regex would be >used >> as "find", as there is no $ to indicate the end of a line. >> >> 3. The ? after the last group indicates that the results could be one >> of >> + Sample1 >> + Sample1-success >> + Sample1-failure >> + Sample2... >> Is this true? Or is just ...-success and ...-failure? In that case >> the ? at the end of the regex should be removed. >> >> Regards, >> Felix >> >> >> >>
