📄 regex-spencer-man.ps
字号:
.55 F/F3 10/Times-Italic@0 SF -.37(re)3.567 G -.1(ge)-.03 G(x)-.1 E F1(\(7\)).53 E F3 6.066(.R).23 G -.4(eg)-6.066 G(comp).4 E F1(com-)3.566 E.251(piles an RE written as a string into an internal form,)108 249.6 RF3 -.37(re)2.751 G -.1(ge)-.03 G(xec)-.1 E F1 .251(matches that internal form ag)2.751 F .251(ainst a string)-.05 F 1.623(and reports results,)108 261.6 R F3 -.37(re)4.122 G -.1(ge)-.03 G(rr).1E(or)-.45 E F1 1.622(transforms error codes from either into human-readable messages, and)4.122 F F3 -.37(re)108 273.6 S(gfr)-.03 E(ee)-.37 E F1(frees an)2.5 E2.5(yd)-.15 G(ynamically-allocated storage used by the internal form of an RE.)-2.5 E.976(The header)108 290.4 R F3(<r)3.476 E -1.8 -.4(eg e)-.37 H(x.h>).2 EF1 .976(declares tw)3.476 F 3.476(os)-.1 G .976(tructure types,)-3.476 FF3 -.37(re)3.477 G -.1(ge)-.03 G(x_t)-.1 E F1(and)3.477 E F3 -.37(re)3.477 G(gmatc)-.03 E(h_t)-.15 E F1 3.477(,t).68 G .977(he former for compiled)-3.477 F .021(internal forms and the latter for match reporting.)108 302.4 R .02(It also declares the four functions, a type)5.02 F F3 -.37(re)2.52 G(gof)-.03 E(f_t)-.18 E F1 2.52(,a).68 G(nd)-2.52 E 2.5(an)108 314.4 S(umber of constants with names starting with `)-2.5 E(`REG_')-.74 E('.)-.74 E F3(Re)108 331.2 Q(gcomp)-.4 E F1 .519(compiles the re)3.019 F.519(gular e)-.15 F .52(xpression contained in the)-.15 F F3(pattern)3.02 E F1 .52(string, subject to the \215ags in)3.02 F F3(c\215a)3.02 E(gs)-.1 E F1(,).27 E .766(and places the results in the)108 343.2 R F3-.37(re)3.266 G -.1(ge)-.03 G(x_t)-.1 E F1 .766(structure pointed to by)3.266 F F3(pr)3.265 E -.4(eg)-.37 G F1(.).62 E F3(C\215a)5.765 E(gs)-.1E F1 .765(is the bitwise OR of zero or)3.265 F(more of the follo)108355.2 Q(wing \215ags:)-.25 E 7.5(REG_EXTENDED Compile)108 372 R .652(modern \(`)3.152 F(`e)-.74 E(xtended')-.15 E .652('\) REs, rather than the obsolete \(`)-.74 F(`basic')-.74 E .653('\) REs that)-.74 F(are the def)196.32 384 Q(ault.)-.1 E(REG_B)108400.8 Q 31.72(ASIC This)-.35 F 2.067(is a synon)4.567 F 2.066(ym for 0, pro)-.15 F 2.066(vided as a counterpart to REG_EXTENDED to)-.15 F(impro)196.32 412.8 Q 1.355 -.15(ve r)-.15 H(eadability).15 E6.055(.T)-.65 G 1.055(his is an e)-6.055 F 1.055(xtension, compatible with b)-.15 F 1.055(ut not speci\214ed by)-.2 F2.35(POSIX 1003.2, and should be used with caution in softw)196.32 424.8R 2.349(are intended to be)-.1 F(portable to other systems.)196.32 436.8Q 22.48(REG_NOSPEC Compile)108 453.6 R .688(with recognition of all special characters turned of)3.187 F 3.188(f. All)-.25 F .688(characters are)3.188 F 1.248(thus considered ordinary)196.32 465.6 R 3.748(,s)-.65 G 3.748(ot)-3.748G 1.247(he `)-3.748 F(`RE')-.74 E 3.747('i)-.74 G 3.747(sal)-3.747 G1.247(iteral string.)-3.747 F 1.247(This is an e)6.247 F(xtension,)-.15E 1.522(compatible with b)196.32 477.6 R 1.523(ut not speci\214ed by POSIX 1003.2, and should be used with)-.2 F .266(caution in softw)196.32 489.6 R .265(are intended to be portable to other systems.)-.1 F(REG_EXTENDED)5.265E(and REG_NOSPEC may not be used in the same call to)196.32 501.6 Q F3-.37(re)2.5 G(gcomp)-.03 E F1(.).19 E 31.93(REG_ICASE Compile)108 518.4R(for matching that ignores upper/lo)2.5 E(wer case distinctions.)-.25 E(See)5 E F3 -.37(re)2.5 G -.1(ge)-.03 G(x)-.1 E F1(\(7\)).53 E F3(.).23E F1 26.93(REG_NOSUB Compile)108 535.2 R 1.966(for matching that need only report success or f)4.466 F 1.967(ailure, not what w)-.1 F(as)-.1 E(matched.)196.32 547.2 Q 15.28(REG_NEWLINE Compile)108 564 R 1.999(for ne)4.499 F(wline-sensiti)-.25 E2.299 -.15(ve m)-.25 H 4.498(atching. By).15 F(def)4.498 E 1.998(ault, ne)-.1 F 1.998(wline is a completely)-.25 F 1.264(ordinary character with no special meaning in either REs or strings.)196.32 576 R -.4(Wi)6.265 G 1.265(th this).4 F 1.069(\215ag, `[^' brack)196.32 588 R 1.069(et e)-.1 F 1.069(xpressions and `.)-.15 F 3.569('n)-.7 G -2.15 -.25(ev e)-3.569 H 3.569(rm).25 G 1.069(atch ne)-3.569 F1.068(wline, a `^' anchor matches)-.25 F .903(the null string after an)196.32 600 R 3.403(yn)-.15 G -.25(ew)-3.403 G .903(line in the string in addition to its normal function,).25 F 1.521(and the `$' anchor matches the null string before an)196.32 612 R 4.021(yn)-.15 G -.25(ew)-4.021 G 1.521(line in the string in).25 F(addition to its normal function.)196.32 624 Q 34.71(REG_PEND The)108640.8 R(re)3.655 E 1.155(gular e)-.15 F 1.156(xpression ends, not at the \214rst NUL, b)-.15 F 1.156(ut just before the character)-.2 F 2.126(pointed to by the)196.32 652.8R F3 -.37(re)4.626 G(_endp).37 E F1 2.126(member of the structure pointed to by)4.626 F F3(pr)4.625 E -.4(eg)-.37G F1 7.125(.T).62 G(he)-7.125 E F3 -.37(re)196.32 664.8 S(_endp).37 E F1.404(member is of type)2.904 F F3(const c)2.904 E(har *)-.15 E F1 5.405(.T).42 G .405(his \215ag permits inclusion of NULs in)-5.405 F .06(the RE; the)196.32 676.8 R 2.56(ya)-.15 G .06(re considered ordinary characters.)-2.56 F .059(This is an e)5.059 F.059(xtension, compatible)-.15 F .154(with b)196.32 688.8 R .155(ut not\ speci\214ed by POSIX 1003.2, and should be used with caution in soft-)-.2 F -.1(wa)196.32 700.8 S(re intended to be portable to other systems.).1 E .621(When successful,)108 717.6 R F3 -.37(re)3.121 G(gcomp)-.03 E F1 .62(returns 0 and \214lls in the structure pointed to by)3.121 F F3(pr)3.12E -.4(eg)-.37 G F1 5.62(.O).62 G .62(ne member of that)-5.62 F .633(structure \(other than)108 729.6 R F3 -.37(re)3.134 G(_endp).37 E F13.134(\)i).19 G 3.134(sp)-3.134 G(ublicized:)-3.134 E F3 -.37(re)3.134 G(_nsub).37 E F1 3.134(,o).23 G 3.134(ft)-3.134 G(ype)-3.134 E F3(size_t)3.134 E F1 3.134(,c).68 G .634(ontains the number of parenthe-)-3.134 F3.225(sized sube)108 741.6 R 3.225(xpressions within the RE \(e)-.15 F3.224(xcept that the v)-.15 F 3.224(alue of this member is unde\214ned if the)-.25 F(REG_NOSUB \215ag w)108753.6 Q(as used\).)-.1 E(If)5 E F3 -.37(re)2.5 G(gcomp)-.03 E F1 -.1(fa)2.5 G(ils, it returns a non-zero error code; see DIA).1 E(GNOSTICS.)-.4E F3(Re)108 770.4 Q -.1(ge)-.4 G(xec)-.1 E F1 .722(matches the compiled RE pointed to by)3.222 F F3(pr)3.222 E -.4(eg)-.37G F1(ag)3.622 E .722(ainst the)-.05 F F3(string)3.222 E F1 3.222(,s).22G .722(ubject to the \215ags in)-3.222 F F3(e\215a)3.223 E(gs)-.1 E F1(,).27 E(25 Sept 1997)271.248 817.889 Q(1)194.247 E 0 Cg EP%%Page: 2 2%%BeginPageSetupBP%%EndPageSetup/F0 10/Times-Roman@0 SF 358.795(REGEX\(3\) REGEX\(3\))72 48 R .147(and reports results using)108 84 R/F1 10/Times-Italic@0 SF(nmatc)2.647E(h)-.15 E F0(,).28 E F1(pmatc)2.647 E(h)-.15 E F0 2.647(,a).28 G .147(nd the returned v)-2.647 F 2.646(alue. The)-.25 F .146(RE must ha)2.646F .446 -.15(ve b)-.2 H .146(een compiled by).15 F 3.077(ap)108 96 S(re)-3.077 E .577(vious in)-.25 F -.2(vo)-.4 G .577(cation of).2 F F1 -.37(re)3.077 G(gcomp)-.03 E F0 5.577(.T).19 G .577(he compiled form is not altered during e)-5.577 F -.15(xe)-.15 G .577(cution of).15 F F1 -.37(re)3.078 G -.1(ge)-.03 G(xec)-.1 E F0 3.078(,s).31 G 3.078(oa)-3.078 G(single compiled RE can be used simultaneously by multiple threads.)108108 Q .186(By def)108 124.8 R .186(ault, the NUL-terminated string pointed to by)-.1 F F1(string)2.686 EF0 .186(is considered to be the te)2.686 F .185(xt of an entire line,)-.15 F 1.113(with the NUL indicating the end of the line.)108 136.8 R1.113(\(That is, an)6.113 F 3.613(yo)-.15 G 1.113(ther end-of-line mark)-3.613 F 1.114(er is considered to)-.1 F(ha)108 148.8 Q .651 -.15(ve b)-.2 H .351(een remo).15 F -.15(ve)-.15 G 2.851(da).15 G .351(nd replaced by the NUL.\))-2.851 F(The)5.35 E F1(e\215a)2.85 E(gs)-.1 EF0(ar)2.85 E .35(gument is the bitwise OR of zero or more)-.18 F(of the follo)108 160.8 Q(wing \215ags:)-.25 E(REG_NO)108 177.6 Q 18.04(TBOL The)-.4 F 1.15(\214rst character of the string is not the be)3.65F 1.151(ginning of a line, so the `^' anchor)-.15 F .945(should not match before it.)193.69 189.6 R .945(This does not af)5.945F .945(fect the beha)-.25 F .945(vior of ne)-.2 F .945(wlines under)-.25F(REG_NEWLINE.)193.69 201.6 Q(REG_NO)108 218.4 Q 18.6(TEOL The)-.4 F .53(NUL terminating the string does not end a line, so the `$' anchor shou\ld not)3.03 F .316(match before it.)193.69 230.4 R .316(This does not af)5.316 F .315(fect the beha)-.25 F .315(vior of ne)-.2F .315(wlines under REG_NEW)-.25 F(-)-.65 E(LINE.)193.69 242.4 Q(REG_ST)108 259.2 Q(AR)-.93 E 7.5(TEND The)-.6 F .537(string is considered to start at)3.037 F F1(string)3.037 E F0(+)2.5 EF1(pmatc)3.037 E(h)-.15 E F0([0].)A F1(rm_so)A F0 .538(and to ha)3.037 F.838 -.15(ve a t)-.2 H(ermi-).15 E 1.767(nating NUL located at)193.69271.2 R F1(string)4.267 E F0(+)2.5 E F1(pmatc)4.267 E(h)-.15 E F0([0].)AF1(rm_eo)A F0 1.767(\(there need not actually be a)4.267 F .551(NUL at that location\), re)193.69 283.2 R -.05(ga)-.15 G .552(rdless of the v).05 F .552(alue of)-.25 F F1(nmatc)3.052 E(h)-.15 E F05.552(.S).28 G .552(ee belo)-5.552 F 3.052(wf)-.25 G .552(or the de\214-)-3.052 F .084(nition of)193.69 295.2 R F1(pmatc)2.584 E(h)-.15 E F0(and)2.584 E F1(nmatc)2.584 E(h)-.15 E F0 5.084(.T).28 G.083(his is an e)-5.084 F .083(xtension, compatible with b)-.15 F .083(ut not speci-)-.2 F .059(\214ed by POSIX 1003.2, and should be used with caution in softw)193.69307.2 R .059(are intended to be)-.1 F .032(portable to other systems.)193.69 319.2 R .032(Note that a non-zero)5.032 F F1(rm_so)2.532 E F0.032(does not imply REG_NO)2.532 F -.92(T-)-.4 G 2.057(BOL; REG_ST)193.69 331.2 R(AR)-.93 E 2.057(TEND af)-.6 F 2.057(fects only the location of the string, not ho)-.25 F 4.557(wi)-.25 G4.558(ti)-4.557 G(s)-4.558 E(matched.)193.69 343.2 Q(See)108 360 Q F1-.37(re)3.136 G -.1(ge)-.03 G(x)-.1 E F0 .636(\(7\) for a discussion of\ what is matched in situations where an RE or a portion thereof could).53 F(match an)108 372 Q 2.5(yo)-.15 G 2.5(fs)-2.5 G -2.15 -.25(ev e)-2.5 H(ral substrings of).25 E F1(string)2.5 E F0(.).22 E(Normally)108388.8 Q(,)-.65 E F1 -.37(re)3.823 G -.1(ge)-.03 G(xec)-.1 E F0 1.323(returns 0 for success and the non-zero code REG_NOMA)3.823 F 1.324(TCH for f)-1.11 F 3.824(ailure. Other)-.1 F(non-zero error codes may be returned in e)108 400.8 Q(xceptional situations; see DIA)-.15 E(GNOSTICS.)-.4 E 1.355(If REG_NOSUB w)108 417.6 R 1.355(as speci\214ed in the compilation of the RE, or if)-.1 F F1(nmatc)3.855E(h)-.15 E F0 1.355(is 0,)3.855 F F1 -.37(re)3.855 G -.1(ge)-.03 G(xec)-.1 E F0 1.355(ignores the)3.855 F F1(pmatc)108 429.6 Q(h)-.15 E F0(ar)5.013 E 2.513(gument \(b)-.18 F 2.513(ut see belo)-.2 F 5.014(wf)-.25 G2.514(or the case where REG_ST)-5.014 F(AR)-.93 E 2.514(TEND is speci\214ed\).)-.6 F(Otherwise,)7.514 E F1(pmatc)108 441.6 Q(h)-.15 E F0 1.082(points to an array of)3.582 F F1(nmatc)3.582 E(h)-.15 EF0 1.082(structures of type)3.582 F F1 -.37(re)3.581 G(gmatc)-.03 E(h_t)-.15 E F0 6.081(.S).68 G 1.081(uch a structure has at least the)-6.081 F(members)108 453.6 Q F1(rm_so)3.09 E F0(and)3.09 E F1(rm_eo)3.09 E F03.09(,b).18 G .59(oth of type)-3.09 F F1 -.37(re)3.09 G(gof)-.03 E(f_t)-.18 E F0 .59(\(a signed arithmetic type at least as lar)3.09 F .591(ge as an)-.18 F F1(of)3.091 E(f_t)-.18 E F0 .079(and a)108 465.6 R F1(ssize_t)2.579 E F0 .079(\), containing respecti).68 F -.15(ve)-.25 G.079(ly the of).15 F .079(fset of the \214rst character of a substring and the of)-.25 F .078(fset of the)-.25 F 1.332(\214rst character after the end of the substring.)108 477.6 R(Of)6.332E 1.332(fsets are measured from the be)-.25 F 1.333(ginning of the)-.15F F1(string)3.833 E F0(ar)108 489.6 Q .203(gument gi)-.18 F -.15(ve)-.25G 2.703(nt).15 G(o)-2.703 E F1 -.37(re)2.703 G -.1(ge)-.03 G(xec)-.1 EF0 5.203(.A).31 G 2.703(ne)-5.203 G .203(mpty substring is denoted by equal of)-2.703 F .203(fsets, both indicating the charac-)-.25 F(ter follo)108 501.6 Q(wing the empty substring.)-.25 E .132(The 0th member of the)108 518.4 RF1(pmatc)2.632 E(h)-.15 E F0 .132(array is \214lled in to indicate what substring of)2.632 F F1(string)2.633 E F0 -.1(wa)2.633 G 2.633(sm).1 G .133(atched by the)-2.633 F1.089(entire RE.)108 530.4 R 1.089(Remaining members report what substring w)6.089 F 1.088(as matched by parenthesized sube)-.1 F(xpressions)-.15 E 1.201(within the RE; member)108 542.4 R F1(i)3.701 E F0 1.202(reports sube)3.701 F(xpression)-.15 E F1(i)3.702 E F0 3.702(,w).36 G 1.202(ith sube)-3.702 F 1.202(xpressions counted \(starting at 1\) by the)-.15 F .394(order of their opening parentheses in the RE, left to right.)108 554.4R .393(Unused entries in the array\212corresponding)5.393 F 1.212(either to sube)108 566.4 R 1.212(xpressions that did not participate in the match at all, or to sube)-.15 F 1.212(xpressions that do not)-.15 F -.15(ex)108 578.4 S .317(ist in the RE \(that is,).15 F F1(i)2.816 E F0(>)2.5 E F1(pr)2.816 E-.4(eg)-.37 G F0<ad3e>.4 E F1 -.37(re)C(_nsub).37 E F0(\)\212ha)A .616-.15(ve b)-.2 H(oth).15 E F1(rm_so)2.816 E F0(and)2.816 E F1(rm_eo)2.816E F0 .316(set to \2551.)2.816 F .316(If a sube)5.316 F(xpression)-.15 E.713(participated in the match se)108 590.4 R -.15(ve)-.25 G .713(ral times, the reported substring is the last one it matched.).15 F.714(\(Note, as an)5.714 F -.15(ex)108 602.4 S 2.674(ample in particular).15 F 5.174(,t)-.4 G 2.674(hat when the RE `\(b*\)+' matches `bbb', the parenthesized sube)-5.174F(xpression)-.15 E 1.928(matches the three `b')108 614.4 R 4.428(sa)-.55G 1.928(nd then an in\214nite number of empty strings follo)-4.428 F1.929(wing the last `b', so the)-.25 F(reported substring is one of the empties.\))108 626.4 Q .4(If REG_ST)108 643.2 R(AR)-.93 E .4(TEND is speci\214ed,)-.6 F F1(pmatc)2.9 E(h)-.15 E F0 .4(must point to at least one)2.9 F F1 -.37(re)2.9 G(gmatc)-.03 E(h_t)-.15 E F0(\(e)2.9 E -.15(ve)-.25 G 2.899(ni).15 G(f)-2.899 EF1(nmatc)2.899 E(h)-.15 E F0 .399(is 0 or)2.899 F .928(REG_NOSUB w)108655.2 R .929(as speci\214ed\), to hold the input of)-.1 F .929(fsets for REG_ST)-.25 F(AR)-.93 E 3.429(TEND. Use)-.6 F .929(for output is still)3.429 F .89(entirely controlled by)108 667.2 R F1(nmatc)3.39 E(h)-.15 E F0 3.39(;i).28 G(f)-3.39 E F1(nmatc)3.39 E(h)-.15E F0 .89(is 0 or REG_NOSUB w)3.39 F .889(as speci\214ed, the v)-.1 F.889(alue of)-.25 F F1(pmatc)3.389 E(h)-.15 E F0([0]).28 E(will not be changed by a successful)108 679.2 Q F1 -.37(re)2.5 G -.1(ge)-.03 G(xec)-.1 E F0(.).31 E F1(Re)108 696 Q -.1(ge)-.4 G(rr).1 E(or)-.45 E F0 .274(maps a non-zero)2.773 F F1(err)2.774 E(code)-.37 E F0.274(from either)2.774 F F1 -.37(re)2.774 G(gcomp)-.03 E F0(or)2.774 EF1 -.37(re)2.774 G -.1(ge)-.03 G(xec)-.1 E F0 .274(to a human-readable, printable mes-)2.774 F 3.584(sage. If)108 708 R F1(pr)3.583 E -.4(eg)-.37 G F0 1.083(is non-NULL, the error code should ha)3.983 F 1.383 -.15(ve a)-.2 H1.083(risen from use of the).15 F F1 -.37(re)3.583 G -.1(ge)-.03 G(x_t)-.1 E F0 1.083(pointed to by)3.583 F F1(pr)108 720 Q -.4(eg)-.37 G F03.713(,a).62 G 1.213(nd if the error code came from)-3.713 F F1 -.37(re)3.714 G(gcomp)-.03 E F0 3.714(,i).19 G 3.714(ts)-3.714 G 1.214(hould ha)-3.714 F 1.514 -.15(ve b)-.2 H 1.214(een the result from the most recent).15 F F1 -.37(re)108 732 S(gcomp)-.03 E F0 .511(using that)3.011 F F1 -.37(re)3.011 G -.1(ge)-.03 G(x_t)-.1 E F0 5.511(.\().68 G F1(Re)-4.881 E -.1(ge)-.4 G(rr).1 E(or)-.45 EF0 .51(may be able to supply a more detailed message using informa-)3.011 F 1.581(tion from the)108 744 R F1 -.37(re)4.081 G -.1(ge)-.03 G(x_t)-.1 E F0(.\)).68 E F1(Re)6.581 E -.1(ge)-.4 G(rr).1 E(or)-.45 E F0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -