/[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 429 by ph10, Tue Sep 1 16:10:16 2009 UTC revision 512 by ph10, Tue Mar 30 11:11:52 2010 UTC
# Line 246  begins with a lookbehind assertion (incl Line 246  begins with a lookbehind assertion (incl
246  </P>  </P>
247  <P>  <P>
248  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
249  empty string, the next call is done with the PCRE_NOTEMPTY and PCRE_ANCHORED  empty string, the next call is done with the PCRE_NOTEMPTY_ATSTART and
250  flags set in order to search for another, non-empty, match at the same point.  PCRE_ANCHORED flags set in order to search for another, non-empty, match at the
251  If this second match fails, the start offset is advanced by one, and the normal  same point. If this second match fails, the start offset is advanced by one
252  match is retried. This imitates the way Perl handles such cases when using the  character, and the normal match is retried. This imitates the way Perl handles
253  <b>/g</b> modifier or the <b>split()</b> function.  such cases when using the <b>/g</b> modifier or the <b>split()</b> function.
254  </P>  </P>
255  <br><b>  <br><b>
256  Other modifiers  Other modifiers
# Line 260  There are yet more modifiers for control Line 260  There are yet more modifiers for control
260  operates.  operates.
261  </P>  </P>
262  <P>  <P>
263    The <b>/8</b> modifier causes <b>pcretest</b> to call PCRE with the PCRE_UTF8
264    option set. This turns on support for UTF-8 character handling in PCRE,
265    provided that it was compiled with this support enabled. This modifier also
266    causes any non-printing characters in output strings to be printed using the
267    \x{hh...} notation if they are valid UTF-8 sequences.
268    </P>
269    <P>
270    If the <b>/?</b> modifier is used with <b>/8</b>, it causes <b>pcretest</b> to
271    call <b>pcre_compile()</b> with the PCRE_NO_UTF8_CHECK option, to suppress the
272    checking of the string for UTF-8 validity.
273    </P>
274    <P>
275  The <b>/+</b> modifier requests that as well as outputting the substring that  The <b>/+</b> modifier requests that as well as outputting the substring that
276  matched the entire pattern, pcretest should in addition output the remainder of  matched the entire pattern, pcretest should in addition output the remainder of
277  the subject string. This is useful for tests where the subject contains  the subject string. This is useful for tests where the subject contains
# Line 274  use in the automatic test scripts; it en Line 286  use in the automatic test scripts; it en
286  for different internal link sizes.  for different internal link sizes.
287  </P>  </P>
288  <P>  <P>
 The <b>/L</b> modifier must be followed directly by the name of a locale, for  
 example,  
 <pre>  
   /pattern/Lfr_FR  
 </pre>  
 For this reason, it must be the last modifier. The given locale is set,  
 <b>pcre_maketables()</b> is called to build a set of character tables for the  
 locale, and this is then passed to <b>pcre_compile()</b> when compiling the  
 regular expression. Without an <b>/L</b> modifier, NULL is passed as the tables  
 pointer; that is, <b>/L</b> applies only to the expression on which it appears.  
 </P>  
 <P>  
 The <b>/I</b> modifier requests that <b>pcretest</b> output information about the  
 compiled pattern (whether it is anchored, has a fixed first character, and  
 so on). It does this by calling <b>pcre_fullinfo()</b> after compiling a  
 pattern. If the pattern is studied, the results of that are also output.  
 </P>  
 <P>  
289  The <b>/D</b> modifier is a PCRE debugging feature, and is equivalent to  The <b>/D</b> modifier is a PCRE debugging feature, and is equivalent to
290  <b>/BI</b>, that is, both the <b>/B</b> and the <b>/I</b> modifiers.  <b>/BI</b>, that is, both the <b>/B</b> and the <b>/I</b> modifiers.
291  </P>  </P>
# Line 305  available when the POSIX interface to PC Line 299  available when the POSIX interface to PC
299  reloading compiled patterns below.  reloading compiled patterns below.
300  </P>  </P>
301  <P>  <P>
302  The <b>/S</b> modifier causes <b>pcre_study()</b> to be called after the  The <b>/I</b> modifier requests that <b>pcretest</b> output information about the
303  expression has been compiled, and the results used when the expression is  compiled pattern (whether it is anchored, has a fixed first character, and
304  matched.  so on). It does this by calling <b>pcre_fullinfo()</b> after compiling a
305    pattern. If the pattern is studied, the results of that are also output.
306    </P>
307    <P>
308    The <b>/K</b> modifier requests <b>pcretest</b> to show names from backtracking
309    control verbs that are returned from calls to <b>pcre_exec()</b>. It causes
310    <b>pcretest</b> to create a <b>pcre_extra</b> block if one has not already been
311    created by a call to <b>pcre_study()</b>, and to set the PCRE_EXTRA_MARK flag
312    and the <b>mark</b> field within it, every time that <b>pcre_exec()</b> is
313    called. If the variable that the <b>mark</b> field points to is non-NULL for a
314    match, non-match, or partial match, <b>pcretest</b> prints the string to which
315    it points. For a match, this is shown on a line by itself, tagged with "MK:".
316    For a non-match it is added to the message.
317    </P>
318    <P>
319    The <b>/L</b> modifier must be followed directly by the name of a locale, for
320    example,
321    <pre>
322      /pattern/Lfr_FR
323    </pre>
324    For this reason, it must be the last modifier. The given locale is set,
325    <b>pcre_maketables()</b> is called to build a set of character tables for the
326    locale, and this is then passed to <b>pcre_compile()</b> when compiling the
327    regular expression. Without an <b>/L</b> modifier, NULL is passed as the tables
328    pointer; that is, <b>/L</b> applies only to the expression on which it appears.
329  </P>  </P>
330  <P>  <P>
331  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 321  present, and REG_NEWLINE is set if <b>/m Line 339  present, and REG_NEWLINE is set if <b>/m
339  force PCRE_DOLLAR_ENDONLY always, and PCRE_DOTALL unless REG_NEWLINE is set.  force PCRE_DOLLAR_ENDONLY always, and PCRE_DOTALL unless REG_NEWLINE is set.
340  </P>  </P>
341  <P>  <P>
342  The <b>/8</b> modifier causes <b>pcretest</b> to call PCRE with the PCRE_UTF8  The <b>/S</b> modifier causes <b>pcre_study()</b> to be called after the
343  option set. This turns on support for UTF-8 character handling in PCRE,  expression has been compiled, and the results used when the expression is
344  provided that it was compiled with this support enabled. This modifier also  matched.
 causes any non-printing characters in output strings to be printed using the  
 \x{hh...} notation if they are valid UTF-8 sequences.  
 </P>  
 <P>  
 If the <b>/?</b> modifier is used with <b>/8</b>, it causes <b>pcretest</b> to  
 call <b>pcre_compile()</b> with the PCRE_NO_UTF8_CHECK option, to suppress the  
 checking of the string for UTF-8 validity.  
345  </P>  </P>
346  <br><a name="SEC5" href="#TOC1">DATA LINES</a><br>  <br><a name="SEC5" href="#TOC1">DATA LINES</a><br>
347  <P>  <P>
# Line 370  recognized: Line 381  recognized:
381                 ated by next non-alphanumeric character)                 ated by next non-alphanumeric character)
382    \L         call pcre_get_substringlist() after a successful match    \L         call pcre_get_substringlist() after a successful match
383    \M         discover the minimum MATCH_LIMIT and MATCH_LIMIT_RECURSION settings    \M         discover the minimum MATCH_LIMIT and MATCH_LIMIT_RECURSION settings
384    \N         pass the PCRE_NOTEMPTY option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>    \N         pass the PCRE_NOTEMPTY option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>; if used twice, pass the
385                   PCRE_NOTEMPTY_ATSTART option
386    \Odd       set the size of the output vector passed to <b>pcre_exec()</b> to dd (any number of digits)    \Odd       set the size of the output vector passed to <b>pcre_exec()</b> to dd (any number of digits)
387    \P         pass the PCRE_PARTIAL_SOFT option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>; if used twice, pass the    \P         pass the PCRE_PARTIAL_SOFT option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>; if used twice, pass the
388                 PCRE_PARTIAL_HARD option                 PCRE_PARTIAL_HARD option
389    \Qdd       set the PCRE_MATCH_LIMIT_RECURSION limit to dd (any number of digits)    \Qdd       set the PCRE_MATCH_LIMIT_RECURSION limit to dd (any number of digits)
390    \R         pass the PCRE_DFA_RESTART option to <b>pcre_dfa_exec()</b>    \R         pass the PCRE_DFA_RESTART option to <b>pcre_dfa_exec()</b>
391    \S         output details of memory get/free calls during matching    \S         output details of memory get/free calls during matching
392      \Y         pass the PCRE_NO_START_OPTIMIZE option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
393    \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>
394    \?         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>
395    \&#62;dd       start the match at offset dd (any number of digits);    \&#62;dd       start the match at offset dd (any number of digits);
# Line 454  This section describes the output when t Line 467  This section describes the output when t
467  <P>  <P>
468  When a match succeeds, pcretest outputs the list of captured substrings that  When a match succeeds, pcretest outputs the list of captured substrings that
469  <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
470  the whole pattern. Otherwise, it outputs "No match" or "Partial match:"  the whole pattern. Otherwise, it outputs "No match" when the return is
471  followed by the partially matching substring when <b>pcre_exec()</b> returns  PCRE_ERROR_NOMATCH, and "Partial match:" followed by the partially matching
472  PCRE_ERROR_NOMATCH or PCRE_ERROR_PARTIAL, respectively, and otherwise the PCRE  substring when <b>pcre_exec()</b> returns PCRE_ERROR_PARTIAL. For any other
473  negative error number. Here is an example of an interactive <b>pcretest</b> run.  returns, it outputs the PCRE negative error number. Here is an example of an
474    interactive <b>pcretest</b> run.
475  <pre>  <pre>
476    $ pcretest    $ pcretest
477    PCRE version 7.0 30-Nov-2006    PCRE version 7.0 30-Nov-2006
# Line 538  the subject where there is at least one Line 552  the subject where there is at least one
552  </pre>  </pre>
553  (Using the normal matching function on this data finds only "tang".) The  (Using the normal matching function on this data finds only "tang".) The
554  longest matching string is always given first (and numbered zero). After a  longest matching string is always given first (and numbered zero). After a
555  PCRE_ERROR_PARTIAL return, the output is "Partial match:", followed by the  PCRE_ERROR_PARTIAL return, the output is "Partial match:", followed by the
556  partially matching substring.  partially matching substring.
557  </P>  </P>
558  <P>  <P>
# Line 706  Cambridge CB2 3QH, England. Line 720  Cambridge CB2 3QH, England.
720  </P>  </P>
721  <br><a name="SEC15" href="#TOC1">REVISION</a><br>  <br><a name="SEC15" href="#TOC1">REVISION</a><br>
722  <P>  <P>
723  Last updated: 29 August 2009  Last updated: 26 March 2010
724  <br>  <br>
725  Copyright &copy; 1997-2009 University of Cambridge.  Copyright &copy; 1997-2010 University of Cambridge.
726  <br>  <br>
727  <p>  <p>
728  Return to the <a href="index.html">PCRE index page</a>.  Return to the <a href="index.html">PCRE index page</a>.

Legend:
Removed from v.429  
changed lines
  Added in v.512

  ViewVC Help
Powered by ViewVC 1.1.5