This question already has an answer here:
We got the following input:
[18:51:10] [Server thread/INFO]: Tester121 entered area ~ Wilderness - (PvP) ~
We'd like to interpret the input and define different variables.
[$time] [Server thread/INFO]: $player entered area ~ $area - (PvP) ~
The results should be:
time="18:51:10"
player="Tester121"
area="Wilderness"
I am new to stackoverflow, feel free to comment so that I can improve my how to ask skills.
The
=~
operator in[[ ]]
evaluates a regex in POSIX ERE format, and assigns the resulting match groups to the arrayBASH_REMATCH
.