# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"(^\d{4}-\d{2}-\d{2} \d{1,2}:\d{2}:\d{2},\d{3}) (FATAL|ERROR|WARN|INFO|DEBUG) \[(\S*)\] \[(\S*)\] (\S*) - ((?:(?!^[0-9]{4}(?:-[0-9]{2}){2}(?:[^|\r?\n]+){3}).*(?:\r?\n)?)+)"
test_str = ("2022-05-05 12:44:05,122 INFO [NotFromActor] [test-cluster-akka.actor.default-dispatcher-4] com.thatdot.quine.persistor.ExceptionWrappingPersistenceAgent - Persistence backend for core quine data is at Version(12.0.0), this is usable as-is by Version(12.0.0)\n"
"2022-05-05 12:44:05,185 INFO [akka://test-cluster@localhost:10001/user/graph-service] [test-cluster-akka.actor.default-dispatcher-39] com.thatdot.quine.graph.GraphClusterActor - CurrentClusterState(TreeSet(), Set(), Set(), None, Map())\n"
"2022-05-05 12:44:05,193 INFO [NotFromActor] [test-cluster-akka.actor.default-dispatcher-39] com.thatdot.quine.persistor.ExceptionWrappingPersistenceAgent - Persistence backend for Quine Enterprise app state is at Version(1.1.0), this is usable as-is by Version(1.1.0)\n"
"2022-05-05 12:44:06,475 INFO [akka://test-cluster@localhost:10001/user/graph-service] [test-cluster-akka.actor.default-dispatcher-39] com.thatdot.quine.graph.GraphClusterActor - RequestGraphClusterCommitment at: QuineHost(localhost,10001) as member: 1 for shards: List(4, 5, 6, 7)\n"
"2022-05-05 12:44:06,477 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - QuineHost(localhost,10001) is adding a new local shard at idx: 4 to shard map: TrieMap()\n"
"2022-05-05 12:44:06,481 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - QuineHost(localhost,10001) is adding a new local shard at idx: 5 to shard map: TrieMap(4 -> LocalShardRef(Actor[akka://test-cluster/user/shard-4#1793439195]))\n"
"2022-05-05 12:44:06,481 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - QuineHost(localhost,10001) is adding a new local shard at idx: 6 to shard map: TrieMap(5 -> LocalShardRef(Actor[akka://test-cluster/user/shard-5#1810283]), 4 -> LocalShardRef(Actor[akka://test-cluster/user/shard-4#1793439195]))\n"
"2022-05-05 12:44:06,481 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - QuineHost(localhost,10001) is adding a new local shard at idx: 7 to shard map: TrieMap(5 -> LocalShardRef(Actor[akka://test-cluster/user/shard-5#1810283]), 6 -> LocalShardRef(Actor[akka://test-cluster/user/shard-6#1102949325]), 4 -> LocalShardRef(Actor[akka://test-cluster/user/shard-4#1793439195]))\n"
"2022-05-05 12:44:06,547 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.ClusterInterface - QuineHost(localhost,10001) is setting new state to: ClusterStateRecord(FullyConfigured,Milliseconds(1651779846513)) Prior history: [ClusterStateRecord(MemberStarting,Milliseconds(1651779845171))]\n"
"2022-05-05 12:44:06,548 INFO [akka://test-cluster@localhost:10001/user/graph-service] [test-cluster-akka.actor.default-dispatcher-12] com.thatdot.quine.graph.GraphClusterActor - AnnounceClusterState(ClusterStateRecord(FullyConfigured,Milliseconds(1651779846513)),ClusterOperationConfig(Map(0 -> HostActorOpt(QuineHost(localhost,10000),Some(Actor[akka://test-cluster@localhost:10000/user/graph-service#445140876])), 1 -> HostActorOpt(QuineHost(localhost,10001),Some(Actor[akka://test-cluster/user/graph-service#-1798402774])), 2 -> HostActorOpt(QuineHost(localhost,10002),Some(Actor[akka://test-cluster@localhost:10002/user/graph-service#-1382095132]))),List(QuineHost(localhost,10003), QuineHost(localhost,10004)),4,test-cluster,3,Some(QuineHost(localhost,10000)))) on: localhost:10001\n"
"2022-05-05 12:44:06,559 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - Trying to resolve shard for actor selection: ActorSelection[Anchor(akka://test-cluster@localhost:10000/), Path(/user/shard-0)]\n"
"2022-05-05 12:44:06,560 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - Trying to resolve shard for actor selection: ActorSelection[Anchor(akka://test-cluster@localhost:10002/), Path(/user/shard-10)]\n"
"2022-05-05 12:44:06,560 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - Trying to resolve shard for actor selection: ActorSelection[Anchor(akka://test-cluster@localhost:10000/), Path(/user/shard-1)]\n"
"2022-05-05 12:44:06,560 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - Trying to resolve shard for actor selection: ActorSelection[Anchor(akka://test-cluster@localhost:10002/), Path(/user/shard-9)]\n"
"2022-05-05 12:44:06,560 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - Trying to resolve shard for actor selection: ActorSelection[Anchor(akka://test-cluster@localhost:10000/), Path(/user/shard-2)]\n"
"2022-05-05 12:44:06,560 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - Trying to resolve shard for actor selection: ActorSelection[Anchor(akka://test-cluster@localhost:10000/), Path(/user/shard-3)]\n"
"2022-05-05 12:44:06,560 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - Trying to resolve shard for actor selection: ActorSelection[Anchor(akka://test-cluster@localhost:10002/), Path(/user/shard-11)]\n"
"2022-05-05 12:44:06,560 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-41] com.thatdot.quine.graph.GraphCluster - Trying to resolve shard for actor selection: ActorSelection[Anchor(akka://test-cluster@localhost:10002/), Path(/user/shard-8)]\n"
"2022-05-05 12:44:06,607 INFO [NotFromActor] [test-cluster-akka.quine.graph-shard-dispatcher-40] com.thatdot.quine.graph.ClusterInterface - QuineHost(localhost,10001) is setting new state to: ClusterStateRecord(Operating,Milliseconds(1651779846580)) Prior history: [ClusterStateRecord(FullyConfigured,Milliseconds(1651779846513)), ClusterStateRecord(MemberStarting,Milliseconds(1651779845171))]\n"
"2022-05-05 12:44:06,607 INFO [akka://test-cluster@localhost:10001/user/graph-service] [test-cluster-akka.actor.default-dispatcher-12] com.thatdot.quine.graph.GraphClusterActor - AnnounceClusterState(ClusterStateRecord(Operating,Milliseconds(1651779846580)),ClusterOperationConfig(Map(0 -> HostActorOpt(QuineHost(localhost,10000),Some(Actor[akka://test-cluster@localhost:10000/user/graph-service#445140876])), 1 -> HostActorOpt(QuineHost(localhost,10001),Some(Actor[akka://test-cluster/user/graph-service#-1798402774])), 2 -> HostActorOpt(QuineHost(localhost,10002),Some(Actor[akka://test-cluster@localhost:10002/user/graph-service#-1382095132]))),List(QuineHost(localhost,10003), QuineHost(localhost,10004)),4,test-cluster,3,Some(QuineHost(localhost,10000)))) on: localhost:10001\n"
"2022-05-05 12:54:56,494 WARN [SinkRefStageImpl(akka://test-cluster)] [test-cluster-akka.actor.default-dispatcher-33] akka.stream.impl.streamref.SinkRefStageImpl - [SinkRef-839] Stream already completed before remote side materialized, failing now.\n"
"2022-05-05 12:56:39,137 WARN [SinkRefStageImpl(akka://test-cluster)] [test-cluster-akka.actor.default-dispatcher-37] akka.stream.impl.streamref.SinkRefStageImpl - [SinkRef-14261] Stream already completed before remote side materialized, failing now.\n"
"2022-05-05 12:56:50,781 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-35] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 10000 edges\n"
"2022-05-05 12:57:13,931 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-42] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 20000 edges\n"
"2022-05-05 12:57:33,425 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-37] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 30000 edges\n"
"2022-05-05 12:57:53,088 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-33] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 40000 edges\n"
"2022-05-05 12:58:12,422 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-12] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 50000 edges\n"
"2022-05-05 12:58:31,107 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-37] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 60000 edges\n"
"2022-05-05 12:58:49,985 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-4] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 70000 edges\n"
"2022-05-05 12:59:08,559 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-36] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 80000 edges\n"
"2022-05-05 12:59:26,979 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-4] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 90000 edges\n"
"2022-05-05 12:59:46,073 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-42] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 100000 edges\n"
"2022-05-05 13:00:05,268 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-38] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 110000 edges\n"
"2022-05-05 13:00:25,051 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-34] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 120000 edges\n"
"2022-05-05 13:00:44,851 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-36] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 130000 edges\n"
"2022-05-05 13:01:04,730 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-38] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 140000 edges\n"
"2022-05-05 13:01:24,253 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-38] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 150000 edges\n"
"2022-05-05 13:01:44,088 WARN [akka://test-cluster@localhost:10001/user/shard-4/FFF77323397A9001] [test-cluster-akka.actor.default-dispatcher-35] com.thatdot.quine.graph.NodeActorPlus - Node: -2406679665012735 has: 160000 edges")
matches = re.finditer(regex, test_str, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html