FunctionList.xml how to ignore wrong syntax.
-
i’ve been making new parser for my logfile.
but i couldn’t find out a way how to ignore wrong syntax.for example,
[SECTION] part1 {
SECTION 2018-03-22 THU 13:14:23
BLA BLA 1234 : DENY
logloglog}
[SECTION] part2 {
SECTION 2018-03-22 THU 13:16:23
BLA BLA 1234 : COMPLD
logloglog
}[SECTION] part3 {
logloglog
SECTION 2018-03-22 THU 13:18:23
BLA BLA 1234 : DENY
logloglog}
[SECTION] part4 {
SECTION 2018-03-22 THU 13:20:23
}[SECTION] part5 {
}[SECTION] part6 {
logloglog
SECTION 2018-03-22 THU 13:25:23
BLA BLA 1234 : COMPLD
logloglog
}[SECTION] part7 {
SECTION 2018-03-22 THU 13:30:23 BLA BLA 1234 : COMPLD}
i wand to match part2, part6,part7 by RE.
(i use prompt name(=SECTION) and date,time and ‘COMPLD’ word.)i tested RE at https://regex101.com/
(?x)
(?ms)
^(?:[(.+)]\s+) part[0-9]+\s{
\s+
.? # after founding out issue about part6. i added here
(?:\1)\s+[0-9]{4}-[0-9]{2}-[0-9]{2}\s+(?:SUN|MON|TUE|WED|THU|FRI|SAT)\s+[0-9]{2}:[0-9]{2}:[0-9]{2}
\s+
[A-Z0-9]\s+:\s+COMPLD
.*? # after founding out issue about part6. i added here
\s+
}but, i had a problem with ‘part6’.
so i added ‘.*?’ in the middle.however, i think ‘.*?’ is not correct RE
please, help me to solve this issue.
-
Try this:
(?x) (?ms) ^\[(\w+)\]\s+part\d+\s+\{ [^}]*? \1\s+\d{4}-\d{2}-\d{2}\s+(?:SUN|MON|TUE|WED|THU|FRI|SAT)\s+\d{2}:\d{2}:\d{2} [^:]+?\s+:\s+COMPLD [^}]*? \} -
thanks for your help.
i works well~ :)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login