c900ea5017808fb30512f4230601013d31a557ce
[scilab.git] / scilab / modules / string / help / en_US / regexp.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) INRIA - 
5  * 
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  -->
13 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="regexp" xml:lang="en">
14     <refnamediv>
15         <refname>regexp</refname>
16         <refpurpose>find a substring that matches the regular expression
17             string
18         </refpurpose>
19     </refnamediv>
20     <refsynopsisdiv>
21         <title>Calling Sequence</title>
22         <synopsis>[start]=regexp(input,pattern,[flag])
23             [start,end,match]=regexp(input,pattern,[flag])
24             [start,end]=regexp(input,pattern,[flag])
25             [start,end,match]=regexp(input,pattern,[flag])
26         </synopsis>
27     </refsynopsisdiv>
28     <refsection>
29         <title>Arguments</title>
30         <variablelist>
31             <varlistentry>
32                 <term>input</term>
33                 <listitem>
34                     <para>a string.</para>
35                 </listitem>
36             </varlistentry>
37             <varlistentry>
38                 <term>pattern</term>
39                 <listitem>
40                     <para>a character string (under the rules of regular
41                         expression)
42                     </para>
43                 </listitem>
44             </varlistentry>
45             <varlistentry>
46                 <term>start</term>
47                 <listitem>
48                     <para>the starting index of each substring of str that matches the
49                         regular expression string pattern
50                     </para>
51                 </listitem>
52             </varlistentry>
53             <varlistentry>
54                 <term>end</term>
55                 <listitem>
56                     <para>the ending index of each substring of str that matches the
57                         regular expression string pattern
58                     </para>
59                 </listitem>
60             </varlistentry>
61             <varlistentry>
62                 <term>match</term>
63                 <listitem>
64                     <para>the text of each substring of str that matches
65                         <literal>pattern</literal>.
66                     </para>
67                 </listitem>
68             </varlistentry>
69             <varlistentry>
70                 <term>[flag]</term>
71                 <listitem>
72                     <para>'o' for matching the pattern once .</para>
73                 </listitem>
74             </varlistentry>
75         </variablelist>
76     </refsection>
77     <refsection>
78         <title>Description</title>
79         <para>The rules of regular expression are similar to perl language. For a
80             quick start , see <ulink url="http://perldoc.perl.org/perlrequick.html">http://perldoc.perl.org/perlrequick.html</ulink>.
81             For a more in-depth tutorial on , see <ulink url="http://perldoc.perl.org/perlretut.html">http://perldoc.perl.org/perlretut.html</ulink>
82             and for the reference page, see <ulink url="http://perldoc.perl.org/perlre.html">http://perldoc.perl.org/perlre.html</ulink>
83         </para>
84         <para>A difference with Perl is that matching a position but no character
85             (for example, with /^/ or /(?=o)/) is a successful match in Perl but not
86             in Scilab.
87         </para>
88     </refsection>
89     <refsection>
90         <title>Examples</title>
91         <programlisting role="example"><![CDATA[ 
92 regexp('xabyabbbz','/ab*/','o')
93 regexp('a!','/((((((((((a))))))))))\041/')
94 regexp('ABCC','/^abc$/i')
95 regexp('ABC','/ab|cd/i')
96 [a b c]=regexp('XABYABBBZ','/ab*/i')
97  ]]></programlisting>
98     </refsection>
99     <refsection role="see also">
100         <title>See Also</title>
101         <simplelist type="inline">
102             <member>
103                 <link linkend="strindex">strindex</link>
104             </member>
105         </simplelist>
106     </refsection>
107 </refentry>