/[pcre]/code/trunk/doc/html/pcretest.html
ViewVC logotype

Diff of /code/trunk/doc/html/pcretest.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 535 by ph10, Thu Jun 3 19:18:24 2010 UTC revision 579 by ph10, Wed Nov 24 17:39:25 2010 UTC
# Line 215  options that do not correspond to anythi Line 215  options that do not correspond to anythi
215    <b>/U</b>              PCRE_UNGREEDY    <b>/U</b>              PCRE_UNGREEDY
216    <b>/W</b>              PCRE_UCP    <b>/W</b>              PCRE_UCP
217    <b>/X</b>              PCRE_EXTRA    <b>/X</b>              PCRE_EXTRA
218      <b>/Y</b>              PCRE_NO_START_OPTIMIZE
219    <b>/&#60;JS&#62;</b>           PCRE_JAVASCRIPT_COMPAT    <b>/&#60;JS&#62;</b>           PCRE_JAVASCRIPT_COMPAT
220    <b>/&#60;cr&#62;</b>           PCRE_NEWLINE_CR    <b>/&#60;cr&#62;</b>           PCRE_NEWLINE_CR
221    <b>/&#60;lf&#62;</b>           PCRE_NEWLINE_LF    <b>/&#60;lf&#62;</b>           PCRE_NEWLINE_LF
# Line 254  begins with a lookbehind assertion (incl Line 255  begins with a lookbehind assertion (incl
255  If any call to <b>pcre_exec()</b> in a <b>/g</b> or <b>/G</b> sequence matches an  If any call to <b>pcre_exec()</b> in a <b>/g</b> or <b>/G</b> sequence matches an
256  empty string, the next call is done with the PCRE_NOTEMPTY_ATSTART and  empty string, the next call is done with the PCRE_NOTEMPTY_ATSTART and
257  PCRE_ANCHORED flags set in order to search for another, non-empty, match at the  PCRE_ANCHORED flags set in order to search for another, non-empty, match at the
258  same point. If this second match fails, the start offset is advanced by one  same point. If this second match fails, the start offset is advanced, and the
259  character, and the normal match is retried. This imitates the way Perl handles  normal match is retried. This imitates the way Perl handles such cases when
260  such cases when using the <b>/g</b> modifier or the <b>split()</b> function.  using the <b>/g</b> modifier or the <b>split()</b> function. Normally, the start
261    offset is advanced by one character, but if the newline convention recognizes
262    CRLF as a newline, and the current character is CR followed by LF, an advance
263    of two is used.
264  </P>  </P>
265  <br><b>  <br><b>
266  Other modifiers  Other modifiers
# Line 318  example, Line 322  example,
322  For this reason, it must be the last modifier. The given locale is set,  For this reason, it must be the last modifier. The given locale is set,
323  <b>pcre_maketables()</b> is called to build a set of character tables for the  <b>pcre_maketables()</b> is called to build a set of character tables for the
324  locale, and this is then passed to <b>pcre_compile()</b> when compiling the  locale, and this is then passed to <b>pcre_compile()</b> when compiling the
325  regular expression. Without an <b>/L</b> modifier, NULL is passed as the tables  regular expression. Without an <b>/L</b> (or <b>/T</b>) modifier, NULL is passed
326  pointer; that is, <b>/L</b> applies only to the expression on which it appears.  as the tables pointer; that is, <b>/L</b> applies only to the expression on
327    which it appears.
328  </P>  </P>
329  <P>  <P>
330  The <b>/M</b> modifier causes the size of memory block used to hold the compiled  The <b>/M</b> modifier causes the size of memory block used to hold the compiled
# Line 330  The <b>/S</b> modifier causes <b>pcre_st Line 335  The <b>/S</b> modifier causes <b>pcre_st
335  expression has been compiled, and the results used when the expression is  expression has been compiled, and the results used when the expression is
336  matched.  matched.
337  </P>  </P>
338    <P>
339    The <b>/T</b> modifier must be followed by a single digit. It causes a specific
340    set of built-in character tables to be passed to <b>pcre_compile()</b>. It is
341    used in the standard PCRE tests to check behaviour with different character
342    tables. The digit specifies the tables as follows:
343    <pre>
344      0   the default ASCII tables, as distributed in
345            pcre_chartables.c.dist
346      1   a set of tables defining ISO 8859 characters
347    </pre>
348    In table 1, some characters whose codes are greater than 128 are identified as
349    letters, digits, spaces, etc.
350    </P>
351  <br><b>  <br><b>
352  Using the POSIX wrapper API  Using the POSIX wrapper API
353  </b><br>  </b><br>
# Line 368  recognized: Line 386  recognized:
386    \t         tab (\x09)    \t         tab (\x09)
387    \v         vertical tab (\x0b)    \v         vertical tab (\x0b)
388    \nnn       octal character (up to 3 octal digits)    \nnn       octal character (up to 3 octal digits)
389    \xhh       hexadecimal character (up to 2 hex digits)                 always a byte unless &#62; 255 in UTF-8 mode
390      \xhh       hexadecimal byte (up to 2 hex digits)
391    \x{hh...}  hexadecimal character, any number of digits in UTF-8 mode    \x{hh...}  hexadecimal character, any number of digits in UTF-8 mode
392    \A         pass the PCRE_ANCHORED option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \A         pass the PCRE_ANCHORED option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
393    \B         pass the PCRE_NOTBOL option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \B         pass the PCRE_NOTBOL option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
# Line 398  recognized: Line 417  recognized:
417    \Y         pass the PCRE_NO_START_OPTIMIZE option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \Y         pass the PCRE_NO_START_OPTIMIZE option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
418    \Z         pass the PCRE_NOTEOL option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \Z         pass the PCRE_NOTEOL option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
419    \?         pass the PCRE_NO_UTF8_CHECK option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \?         pass the PCRE_NO_UTF8_CHECK option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
420    \&#62;dd       start the match at offset dd (any number of digits);    \&#62;dd       start the match at offset dd (optional "-"; then any number of digits); this sets the <i>startoffset</i>
421                 this sets the <i>startoffset</i> argument for <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>                 argument for <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
422    \&#60;cr&#62;      pass the PCRE_NEWLINE_CR option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \&#60;cr&#62;      pass the PCRE_NEWLINE_CR option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
423    \&#60;lf&#62;      pass the PCRE_NEWLINE_LF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \&#60;lf&#62;      pass the PCRE_NEWLINE_LF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
424    \&#60;crlf&#62;    pass the PCRE_NEWLINE_CRLF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \&#60;crlf&#62;    pass the PCRE_NEWLINE_CRLF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
425    \&#60;anycrlf&#62; pass the PCRE_NEWLINE_ANYCRLF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \&#60;anycrlf&#62; pass the PCRE_NEWLINE_ANYCRLF option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
426    \&#60;any&#62;     pass the PCRE_NEWLINE_ANY option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \&#60;any&#62;     pass the PCRE_NEWLINE_ANY option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
427  </pre>  </pre>
428    Note that \xhh always specifies one byte, even in UTF-8 mode; this makes it
429    possible to construct invalid UTF-8 sequences for testing purposes. On the
430    other hand, \x{hh} is interpreted as a UTF-8 character in UTF-8 mode,
431    generating more than one byte if the value is greater than 127. When not in
432    UTF-8 mode, it generates one byte for values less than 256, and causes an error
433    for greater values.
434    </P>
435    <P>
436  The escapes that specify line ending sequences are literal strings, exactly as  The escapes that specify line ending sequences are literal strings, exactly as
437  shown. No more than one newline setting should be present in any data line.  shown. No more than one newline setting should be present in any data line.
438  </P>  </P>
# Line 475  When a match succeeds, pcretest outputs Line 502  When a match succeeds, pcretest outputs
502  <b>pcre_exec()</b> returns, starting with number 0 for the string that matched  <b>pcre_exec()</b> returns, starting with number 0 for the string that matched
503  the whole pattern. Otherwise, it outputs "No match" when the return is  the whole pattern. Otherwise, it outputs "No match" when the return is
504  PCRE_ERROR_NOMATCH, and "Partial match:" followed by the partially matching  PCRE_ERROR_NOMATCH, and "Partial match:" followed by the partially matching
505  substring when <b>pcre_exec()</b> returns PCRE_ERROR_PARTIAL. For any other  substring when <b>pcre_exec()</b> returns PCRE_ERROR_PARTIAL. (Note that this is
506  returns, it outputs the PCRE negative error number. Here is an example of an  the entire substring that was inspected during the partial match; it may
507  interactive <b>pcretest</b> run.  include characters before the actual match start if a lookbehind assertion,
508    \K, \b, or \B was involved.) For any other returns, it outputs the PCRE
509    negative error number. Here is an example of an interactive <b>pcretest</b> run.
510  <pre>  <pre>
511    $ pcretest    $ pcretest
512    PCRE version 7.0 30-Nov-2006    PCRE version 7.0 30-Nov-2006
# Line 559  the subject where there is at least one Line 588  the subject where there is at least one
588  (Using the normal matching function on this data finds only "tang".) The  (Using the normal matching function on this data finds only "tang".) The
589  longest matching string is always given first (and numbered zero). After a  longest matching string is always given first (and numbered zero). After a
590  PCRE_ERROR_PARTIAL return, the output is "Partial match:", followed by the  PCRE_ERROR_PARTIAL return, the output is "Partial match:", followed by the
591  partially matching substring.  partially matching substring. (Note that this is the entire substring that was
592    inspected during the partial match; it may include characters before the actual
593    match start if a lookbehind assertion, \K, \b, or \B was involved.)
594  </P>  </P>
595  <P>  <P>
596  If <b>/g</b> is present on the pattern, the search for further matches resumes  If <b>/g</b> is present on the pattern, the search for further matches resumes
# Line 726  Cambridge CB2 3QH, England. Line 757  Cambridge CB2 3QH, England.
757  </P>  </P>
758  <br><a name="SEC15" href="#TOC1">REVISION</a><br>  <br><a name="SEC15" href="#TOC1">REVISION</a><br>
759  <P>  <P>
760  Last updated: 16 May 2010  Last updated: 21 November 2010
761  <br>  <br>
762  Copyright &copy; 1997-2010 University of Cambridge.  Copyright &copy; 1997-2010 University of Cambridge.
763  <br>  <br>

Legend:
Removed from v.535  
changed lines
  Added in v.579

  ViewVC Help
Powered by ViewVC 1.1.5