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

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -