regex - TCL Regular Expression Doubt -
According to my understanding of RE
-> * mean Mail 0 or more events of previous regex - -> + means that the previous regex matches 1 or more frequencies
Now take a look at the following examples: < / P>
First: -
% regexp {: +} "DHCP: Enabled" first puts 1% $ first: - & gt; ":" Variable is stored in the first% second: -
% regexp {: *} "DHCP: enabled" puts $ 1% Sec - & gt; Why ":" is stored for the first one and not the other?
second regexp {: *} matches empty string because empty String : has 0 events. If you use the -indices option for regexp , you will see that this position matches 0.
% regexp -indices: * "DHCP: enabled" index puts 1% $ index 0 -1 In other words, regexp matches the first letter Account and returns returns.
Comments
Post a Comment