Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > ebb1914cf182a88528b4547490db1dd8 > files > 1394

kdewebdev-quanta-doc-3.5.9-2mdv2008.1.x86_64.rpm

<HTML
><HEAD
><TITLE
>preg_match</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="manual.html"><LINK
REL="UP"
TITLE="Perl-compatible Regular Expression functions"
HREF="ref.pcre.html"><LINK
REL="PREVIOUS"
TITLE="Perl-compatible Regular Expression functions"
HREF="ref.pcre.html"><LINK
REL="NEXT"
TITLE="preg_match_all"
HREF="function.preg-match-all.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="ref.pcre.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.preg-match-all.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.preg-match"
>preg_match</A
></H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN22657"
></A
>preg_match -- Perform a regular expression match</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN22660"
></A
><H2
>Description</H2
><DIV
CLASS="funcsynopsis"
><P
></P
><CODE
CLASS="FUNCDEF"
>int preg_match</CODE
>(string pattern, string subject, array [<SPAN
CLASS="optional"
>matches</SPAN
>]);<P
></P
></DIV
><P
>&#13;     Searches <TT
CLASS="parameter"
><I
>subject</I
></TT
> for a match to the regular
     expression given in <TT
CLASS="parameter"
><I
>pattern</I
></TT
>.</P
><P
>&#13;     If <TT
CLASS="parameter"
><I
>matches</I
></TT
> is provided, then it is filled
     with the results of search.  $matches[0] will contain the text that
     match the full pattern, $matches[1] will have the text that matched
     the first captured parenthesized subpattern, and so on.</P
><P
>&#13;     Returns true if a match for <TT
CLASS="parameter"
><I
>pattern</I
></TT
> was
     found in the subject string, or false if not match was found
     or an error occurred.</P
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><P
><B
>Example 1. Getting the page number out of a string</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>  1&nbsp;
  2&nbsp;if (preg_match("/page\s+#(\d+)/i", "Go to page #9.", $parts))
  3&nbsp;    print "Next page is $parts[1]";
  4&nbsp;else
  5&nbsp;    print "Page not found.";
  6&nbsp;      </PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>

     See also <A
HREF="function.preg-match-all.html"
><B
CLASS="function"
>preg_match_all()</B
></A
>, 
     <A
HREF="function.preg-replace.html"
><B
CLASS="function"
>preg_replace()</B
></A
>, and
     <A
HREF="function.preg-split.html"
><B
CLASS="function"
>preg_split()</B
></A
>.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="ref.pcre.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="manual.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.preg-match-all.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Perl-compatible Regular Expression functions</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.pcre.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>preg_match_all</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>