📄 7.html
字号:
<HTML><TITLE>Regexp and Regsub</TITLE><BODY BGCOLOR="#FFF0E0" VLINK="#0FBD0F" TEXT="#101000" LINK="#0F0FDD">
<A NAME="top"><H1>Regexp and Regsub</H1>
<P><I> Online chapter from <A HREF="javascript:if(confirm('http://www.mapfree.com/sbf/tcl/book/home.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.mapfree.com/sbf/tcl/book/home.html'" tppabs="http://www.mapfree.com/sbf/tcl/book/home.html">Tcl/Tk for Programmers</A> (with exercises and solutions).</I>
<P>
Much programming in Tcl involves handling data from users, files, or
other
computer programs. Often this data does not arrive in a form that is directly
usable. The need to extract useful pieces from the whole is a major reason
for you to master regular expressions. You will probably use them a lot.
<P> Using regular expressions and using them correctly are not the same thing.
It is not uncommon for a badly written regular expression to pass tests only
to fail in practice. One of the goals of this chapter is to show you how you
can write them well.
<P>
<DL><DD>
<STRONG>7.1 <A HREF="7.1.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/7.1.html">Theory and Practice</A></STRONG><BR>
<STRONG>7.2 <A HREF="7.2.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/7.2.html">Character Set, Quoting, and Style</A></STRONG><BR>
<STRONG>7.3 <A HREF="7.3.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/7.3.html">Regular-Expression versus Glob Patterns</A></STRONG><BR>
<STRONG>7.4 <A HREF="7.4.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/7.4.html">Repetitions and Branches</A></STRONG><BR>
<STRONG>7.5 <A HREF="7.5.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/7.5.html">Use Parentheses to Build more Complicated Patterns</A></STRONG><BR>
<STRONG>7.6 <A HREF="7.6.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/7.6.html">Use Parentheses to Extract Subpatterns</A></STRONG><BR>
<STRONG>7.7 <A HREF="7.7.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/7.7.html">Search and Replace</A></STRONG><BR>
<STRONG>7.8 <A HREF="7.8.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/7.8.html"><CITE>Style Review</CITE></A></STRONG><BR>
<STRONG>7.9 <A HREF="7.9.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/7.9.html">Solutions to Exercises</A></STRONG><BR>
</DL>
<!-- Linkbar -->
<P><CENTER><FONT SIZE=2><NOBR>
<STRONG>Previous</STRONG>
<A HREF="6.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/6.html">chapter</A><WBR>
<STRONG> | Next</STRONG>
<A HREF="8.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/8.html">chapter</A><WBR>
<STRONG> | All</STRONG>
<A HREF="Contents.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/Contents.html">chapters</A><WBR>
<STRONG> | Section</STRONG>
<A HREF="7.1.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/7.1.html">one</A><P>
<STRONG>Related to</STRONG>
<A HREF="javascript:if(confirm('http://www.mapfree.com/sbf/home.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.mapfree.com/sbf/home.html'" tppabs="http://www.mapfree.com/sbf/home.html">Software Build and Fix</A><WBR>
<STRONG>| From</STRONG>
<A HREF="javascript:if(confirm('http://www.mapfree.com/sbf/tcl/home.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.mapfree.com/sbf/tcl/home.html'" tppabs="http://www.mapfree.com/sbf/tcl/home.html">Zimmer's Tcl/Tk Page</A><WBR>
<STRONG>| Author</STRONG>
<A HREF="javascript:if(confirm('http://www.mapfree.com/mp/jaz/home.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.mapfree.com/mp/jaz/home.html'" tppabs="http://www.mapfree.com/mp/jaz/home.html">J. A. Zimmer</A><WBR>
<STRONG>| Copyright</STRONG>
<A HREF="copyright.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/copyright.html">Notice</A>
<P>
<I>Jun 17, 1998</I>
</NOBR></FONT></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -