2009
In this article I will show the difference between the default greedy (.+ and .*) and non-greedy matching using Perl-compatible regular expression.
For example, I have a string in a single line:
$line= "Seq[03] Command : CREATE("A") Seq[04] Command : CREATE("B") Seq[04] error: 5006 Seq[03] error: 5006 Seq[05] Command : DELETE("A") Seq[05] error: 5006 ";
I could capture all the Command without the error code using the following regular expression:
m/Seq\[[0-9]{2}\].+Command.+\(.+\)/gi

For anyone who need to know about commands that shuts down, reboot, hibernate, log off, and/or locking the computer in Windows XP by executing it from Windows XP command prompt or 'console'. This command may be useful in task scheduling or making it programmable.
165 Hits