<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>match(String,String) -- regular expression matching</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_regex.html">next</a> | <a href="_regular_spexpressions.html">previous</a> | <a href="_regex.html">forward</a> | backward | <a href="_regular_spexpressions.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <div><a href="index.html" title="">Macaulay2Doc</a> > <a href="___The_sp__Macaulay2_splanguage.html" title="">The Macaulay2 language</a> > <a href="_strings_spand_spnets.html" title="">strings and nets</a> > <a href="_regular_spexpressions.html" title="">regular expressions</a> > <a href="_match_lp__String_cm__String_rp.html" title="regular expression matching">match(String,String)</a></div> <hr/> <div><h1>match(String,String) -- regular expression matching</h1> <div class="single"><h2>Synopsis</h2> <ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>match(p,s)</tt></div> </dd></dl> </div> </li> <li><span>Function: <a href="_match_lp__String_cm__String_rp.html" title="regular expression matching">match</a></span></li> <li><div class="single">Inputs:<ul><li><span><tt>p</tt>, <span>a <a href="___String.html">string</a></span>, a regular expression</span></li> <li><span><tt>s</tt>, <span>a <a href="___String.html">string</a></span>, a subject string to be searched</span></li> </ul> </div> </li> <li><div class="single">Consequences:<ul><li>the variable <a href="_match_lp__String_cm__String_rp.html" title="regular expression matching">lastMatch</a> is set to the value returned by <a href="_regex.html" title="">regex</a>, which is called by <a href="_match_lp__String_cm__String_rp.html" title="regular expression matching">match</a></li> </ul> </div> </li> <li><div class="single">Outputs:<ul><li><span><span>a <a href="___Boolean.html">Boolean value</a></span>, whether the regular expression <tt>p</tt> matches the string <tt>s</tt></span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><table class="examples"><tr><td><pre>i1 : match ("asd", "--asd--") o1 = true</pre> </td></tr> <tr><td><pre>i2 : lastMatch o2 = {(2, 3)} o2 : List</pre> </td></tr> <tr><td><pre>i3 : match ("asd", "--as--") o3 = false</pre> </td></tr> <tr><td><pre>i4 : lastMatch</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_regular_spexpressions.html" title="">regular expressions</a></span></li> <li><span><a href="_regex.html" title="">regex</a></span></li> <li><span><a href="_replace.html" title="replacement in strings and lists">replace</a> -- replacement in strings and lists</span></li> </ul> </div> </div> </body> </html>