/[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 512 by ph10, Tue Mar 30 11:11:52 2010 UTC revision 545 by ph10, Wed Jun 16 10:51:15 2010 UTC
# Line 201  effect as they do in Perl. For example: Line 201  effect as they do in Perl. For example:
201  <pre>  <pre>
202    /caseless/i    /caseless/i
203  </pre>  </pre>
204  The following table shows additional modifiers for setting PCRE options that do  The following table shows additional modifiers for setting PCRE compile-time
205  not correspond to anything in Perl:  options that do not correspond to anything in Perl:
206  <pre>  <pre>
207      <b>/8</b>              PCRE_UTF8
208      <b>/?</b>              PCRE_NO_UTF8_CHECK
209    <b>/A</b>              PCRE_ANCHORED    <b>/A</b>              PCRE_ANCHORED
210    <b>/C</b>              PCRE_AUTO_CALLOUT    <b>/C</b>              PCRE_AUTO_CALLOUT
211    <b>/E</b>              PCRE_DOLLAR_ENDONLY    <b>/E</b>              PCRE_DOLLAR_ENDONLY
# Line 211  not correspond to anything in Perl: Line 213  not correspond to anything in Perl:
213    <b>/J</b>              PCRE_DUPNAMES    <b>/J</b>              PCRE_DUPNAMES
214    <b>/N</b>              PCRE_NO_AUTO_CAPTURE    <b>/N</b>              PCRE_NO_AUTO_CAPTURE
215    <b>/U</b>              PCRE_UNGREEDY    <b>/U</b>              PCRE_UNGREEDY
216      <b>/W</b>              PCRE_UCP
217    <b>/X</b>              PCRE_EXTRA    <b>/X</b>              PCRE_EXTRA
218    <b>/&#60;JS&#62;</b>           PCRE_JAVASCRIPT_COMPAT    <b>/&#60;JS&#62;</b>           PCRE_JAVASCRIPT_COMPAT
219    <b>/&#60;cr&#62;</b>           PCRE_NEWLINE_CR    <b>/&#60;cr&#62;</b>           PCRE_NEWLINE_CR
# Line 221  not correspond to anything in Perl: Line 224  not correspond to anything in Perl:
224    <b>/&#60;bsr_anycrlf&#62;</b>  PCRE_BSR_ANYCRLF    <b>/&#60;bsr_anycrlf&#62;</b>  PCRE_BSR_ANYCRLF
225    <b>/&#60;bsr_unicode&#62;</b>  PCRE_BSR_UNICODE    <b>/&#60;bsr_unicode&#62;</b>  PCRE_BSR_UNICODE
226  </pre>  </pre>
227  Those specifying line ending sequences are literal strings as shown, but the  The modifiers that are enclosed in angle brackets are literal strings as shown,
228  letters can be in either case. This example sets multiline matching with CRLF  including the angle brackets, but the letters can be in either case. This
229  as the line ending sequence:  example sets multiline matching with CRLF as the line ending sequence:
230  <pre>  <pre>
231    /^abc/m&#60;crlf&#62;    /^abc/m&#60;crlf&#62;
232  </pre>  </pre>
233  Details of the meanings of these PCRE options are given in the  As well as turning on the PCRE_UTF8 option, the <b>/8</b> modifier also causes
234    any non-printing characters in output strings to be printed using the
235    \x{hh...} notation if they are valid UTF-8 sequences. Full details of the PCRE
236    options are given in the
237  <a href="pcreapi.html"><b>pcreapi</b></a>  <a href="pcreapi.html"><b>pcreapi</b></a>
238  documentation.  documentation.
239  </P>  </P>
# Line 260  There are yet more modifiers for control Line 266  There are yet more modifiers for control
266  operates.  operates.
267  </P>  </P>
268  <P>  <P>
 The <b>/8</b> modifier causes <b>pcretest</b> to call PCRE with the PCRE_UTF8  
 option set. This turns on support for UTF-8 character handling in PCRE,  
 provided that it was compiled with this support enabled. This modifier also  
 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.  
 </P>  
 <P>  
269  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
270  matched the entire pattern, pcretest should in addition output the remainder of  matched the entire pattern, pcretest should in addition output the remainder of
271  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 324  example, Line 318  example,
318  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,
319  <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
320  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
321  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
322  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
323    which it appears.
324  </P>  </P>
325  <P>  <P>
326  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
327  pattern to be output.  pattern to be output.
328  </P>  </P>
329  <P>  <P>
 The <b>/P</b> modifier causes <b>pcretest</b> to call PCRE via the POSIX wrapper  
 API rather than its native API. When this is done, all other modifiers except  
 <b>/i</b>, <b>/m</b>, and <b>/+</b> are ignored. REG_ICASE is set if <b>/i</b> is  
 present, and REG_NEWLINE is set if <b>/m</b> is present. The wrapper functions  
 force PCRE_DOLLAR_ENDONLY always, and PCRE_DOTALL unless REG_NEWLINE is set.  
 </P>  
 <P>  
330  The <b>/S</b> modifier causes <b>pcre_study()</b> to be called after the  The <b>/S</b> modifier causes <b>pcre_study()</b> to be called after the
331  expression has been compiled, and the results used when the expression is  expression has been compiled, and the results used when the expression is
332  matched.  matched.
333  </P>  </P>
334    <P>
335    The <b>/T</b> modifier must be followed by a single digit. It causes a specific
336    set of built-in character tables to be passed to <b>pcre_compile()</b>. It is
337    used in the standard PCRE tests to check behaviour with different character
338    tables. The digit specifies the tables as follows:
339    <pre>
340      0   the default ASCII tables, as distributed in
341            pcre_chartables.c.dist
342      1   a set of tables defining ISO 8859 characters
343    </pre>
344    In table 1, some characters whose codes are greater than 128 are identified as
345    letters, digits, spaces, etc.
346    </P>
347    <br><b>
348    Using the POSIX wrapper API
349    </b><br>
350    <P>
351    The <b>/P</b> modifier causes <b>pcretest</b> to call PCRE via the POSIX wrapper
352    API rather than its native API. When <b>/P</b> is set, the following modifiers
353    set options for the <b>regcomp()</b> function:
354    <pre>
355      /i    REG_ICASE
356      /m    REG_NEWLINE
357      /N    REG_NOSUB
358      /s    REG_DOTALL     )
359      /U    REG_UNGREEDY   ) These options are not part of
360      /W    REG_UCP        )   the POSIX standard
361      /8    REG_UTF8       )
362    </pre>
363    The <b>/+</b> modifier works as described above. All other modifiers are
364    ignored.
365    </P>
366  <br><a name="SEC5" href="#TOC1">DATA LINES</a><br>  <br><a name="SEC5" href="#TOC1">DATA LINES</a><br>
367  <P>  <P>
368  Before each data line is passed to <b>pcre_exec()</b>, leading and trailing  Before each data line is passed to <b>pcre_exec()</b>, leading and trailing
# Line 429  the call of <b>pcre_exec()</b> for the l Line 449  the call of <b>pcre_exec()</b> for the l
449  </P>  </P>
450  <P>  <P>
451  If the <b>/P</b> modifier was present on the pattern, causing the POSIX wrapper  If the <b>/P</b> modifier was present on the pattern, causing the POSIX wrapper
452  API to be used, the only option-setting sequences that have any effect are \B  API to be used, the only option-setting sequences that have any effect are \B,
453  and \Z, causing REG_NOTBOL and REG_NOTEOL, respectively, to be passed to  \N, and \Z, causing REG_NOTBOL, REG_NOTEMPTY, and REG_NOTEOL, respectively,
454  <b>regexec()</b>.  to be passed to <b>regexec()</b>.
455  </P>  </P>
456  <P>  <P>
457  The use of \x{hh...} to represent UTF-8 characters is not dependent on the use  The use of \x{hh...} to represent UTF-8 characters is not dependent on the use
# Line 720  Cambridge CB2 3QH, England. Line 740  Cambridge CB2 3QH, England.
740  </P>  </P>
741  <br><a name="SEC15" href="#TOC1">REVISION</a><br>  <br><a name="SEC15" href="#TOC1">REVISION</a><br>
742  <P>  <P>
743  Last updated: 26 March 2010  Last updated: 14 June 2010
744  <br>  <br>
745  Copyright &copy; 1997-2010 University of Cambridge.  Copyright &copy; 1997-2010 University of Cambridge.
746  <br>  <br>

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

  ViewVC Help
Powered by ViewVC 1.1.5