I’m new to perl and having a problem matching a particular portion of a string.
What I’m trying to match is in bold:
[1339300800] CURRENT HOST STATE: Something;
I was successfully able to match the String between the brackets, at least!
($line=~/\[(\d*)\]*/)
I’m trying something like this for the bolded portion:
($line=~/STATE:\s(\S+);/)
Could anyone give some advice?
Your regex
Does work for me. Remember that it is matched in group 1
Also, the first regex can be made a bit less verbose