regex - Need explanation of tcl regexp inline example in the man page please -


While looking at the regexp and --inline usage, looked at this example but did not understand how to Works.

Link to the man page: In this, under the --line option, this example was given:

  regexp -inline - {\ w (\ w)} "Inline" = & gt; {In}} regexp -all -inline - {\ w (\ w)} "inline" = & gt; {In n li i ne e}  

How do "{\ w (\ w)}" yield "{in}}"? Can anyone please explain

thanks

If -inline < / Code> but not -all is given, regexp returns a list corresponding to a value for a whole field and each receipt (captured by parentheses) Fields) gives a value for it. To see what the whole match is, ignore the parenthesis: the pattern is now {\ w \ w} , matching the two first word characters in the string ( in ) Accounts. If you exclude a word character (outside of brackets \ w ) and then capture the character of the next word ( \ w inside brackets), you get The first ridge is with. , Getting n

If both of -inline and -all are given, regexp it does this repeatedly, the last whole Restart the character before the match.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -