<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<!--This is an automatically generated file. DO NOT EDIT THIS FILE DIRECTLY. Rather, use the _ref.xml files found in the 'edits' folder.-->
<c74object name="regexp" module="max" category="Math">
	<digest>
		Use regular expressions to process input
	</digest>
	<description>
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
		<metadata name="tag">
			Math
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				re, substitute, or text in
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				re, substitute, or text in
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				substitutions
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="OUTLET_TYPE">
			<digest>
				backreferences
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="2" type="OUTLET_TYPE">
			<digest>
				substrings
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="3" type="OUTLET_TYPE">
			<digest>
				unmatched
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="4" type="OUTLET_TYPE">
			<digest>
				dumpout
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="expression" optional="1" type="symbol">
			<digest>
				Regular expression
			</digest>
			<description>
				A regular expression may be used as an argument to set the regular expression (see above for regular expression formatting and metacharacter information).
			</description>
		</objarg>
		<objarg name="substitution" optional="1" type="symbol">
			<digest>
				Substitution string
			</digest>
			<description>
				An optional second argument will set the substitution string.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="int">
			<arglist>
				<arg name="subject-string" optional="0" type="int" />
			</arglist>
			<digest>
				Process with regular expression
			</digest>
			<description>
				Any <m>int</m> received in the <o>regexp</o> object's inlet is treated as the subject string to be processed according to the regular expression and symbol substitutions provided.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="subject-string" optional="0" type="float" />
			</arglist>
			<digest>
				Process with regular expression
			</digest>
			<description>
				Any <m>float</m> received in the <o>regexp</o> object's inlet is treated as the subject string to be processed according to the regular expression and symbol substitutions provided.
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="subject-string" optional="0" type="list" />
			</arglist>
			<digest>
				Process with regular expression
			</digest>
			<description>
				Any symbol or list received in the regexp object's inlet (not matching the object's attributes) is treated as the subject string to be processed according to the regular expression and symbol substitutions provided.
			</description>
		</method>
		<method name="anything">
			<arglist>
				<arg name="subject-string" optional="0" type="list" />
			</arglist>
			<digest>
				Process with regular expression
			</digest>
			<description>
				Performs the same function as a <m>list</m> message.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="re" get="1" set="1" type="symbol" size="1">
			<digest>
				Regular expression
			</digest>
			<description>
				The word <m>re</m>, followed by a PERL-compatible regular expression, sets the regular expression rules to be used when parsing or making substitutions within any symbol or list input.
				<br />
				<br />
				If a regular expression contains spaces, it must be enclosed within double quotes when specified using the <m>re</m> message or as a typed-in argument to the regexp object.
				<br />
				<br />
				Regular expressions use the following form and syntax:
				<br />
				<br />
				<m>[...]</m> defines a 'class' of characters. any of the characters within it may be matched. several special symbols may also appear within it:
				<br />
				<br />
				<m>...-...</m> specifies a range (within ASCII codes)
				<br />
				<br />
				<m>\\d</m> specifies a decimal digit (<m>\\D</m> specifies a non-decimal digit). Note that double backslashes must be used -- Max erases single backslashes.
				<br />
				<br />
				<m>\\s</m> specifies white space (<m>\\S</m> specifies non-white space). Note that double backslashes must be used -- Max erases single backslashes.
				<br />
				<br />
				<m>\\w</m> specifies an alphanumeric (<m>\\W</m> specifies a nonalphanumeric). Note that double backslashes must be used -- Max erases single backslashes.
				<br />
				<br />
				<m>^...</m> specifies a complement of
				<br />
				<br />
				<m>...*</m> appears zero times
				<br />
				<br />
				<m>...+</m> appears at least once
				<br />
				<br />
				<m>...?</m> appears once or not at all
				<br />
				<br />
				<m>(...)</m> specifies a backreference that may be referred to in a substitution string such as <m>%n</m>, where <m>n</m> is the position of the parenthesis in left-to-right order.
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="symbol" size="1" value="Value" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Regular Expression" />
			</attributelist>
		</attribute>
		<attribute name="substitute" get="1" set="1" type="symbol" size="1">
			<digest>
				Substitution symbol
			</digest>
			<description>
				The word <m>substitute</m>, followed by a symbol, passes a symbol to be used in substitutions. If the word <m>substitute</m> is not followed by a symbol, the previous substitution symbol is removed.
				<br />
				<br />
				Note: If you need to output a <m>%</m> followed by a number in any substitution string, you should use <m>%%</m>, so that the <m>%</m> is not read as a backreference.
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="symbol" size="1" value="Value" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Substitution String" />
			</attributelist>
		</attribute>
		<attribute name="tosymbol" get="1" set="1" type="int" size="1">
			<digest>
				Output mode
			</digest>
			<description>
				The word <m>tosymbol</m>, followed by a zero or one, toggles the output behavior of the <o>regexp</o> object. When enabled, output from the left outlet of the object will be a single symbol. When disabled, output from the left outlet of the object will consist of a list of individual elements.
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="symbol" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Output a Symbol" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="regexp.png" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="fromsymbol" />
		<seealso name="key" />
		<seealso name="keyup" />
		<seealso name="message" />
		<seealso name="spell" />
		<seealso name="tosymbol" />
	</seealsolist>
	<discussion>
		With <o>regexp</o>, it's possible to use PERL-compatible regular expressions to parse or make substitutions within symbols and lists. The argument is a symbol that sets the RE, as does the 're' command in the left inlet. the 'substitute' command passes a symbol to be used in substitutions - if no symbol is present, it removes the previous one. Any other symbol or list in the left inlet is treated as the subject string, and is processed according to those parameters. The middle outlet reports a list of the instances where the RE matched portions of the subject string. If the RE contains parentheses, they are treated as backreferences, and the center-left outlet puts them into a list upon every match within the subject string. If a 'substitute' string has been set, the leftmost output returns the subject string with necessary substitutions. (n.b. substitute strings may contain back references, of the form %n)
	</discussion>
	<misc name="Output">
		<entry name="symbol or list">
			<description>
				Out left outlet: If a substitute string has been set using the <m>substitute</m> message, the input list or symbol is sent out the left outlet with any required substitutions (n.b. substitute strings may contain back references, of the form <m>%n</m>).
				<br />
				<br />
				Out center-left outlet: If the regular expressions contains parentheses, they are treated as backreferences. The middle outlet reports the backreferences upon every match within the subject string, and outputs them in the form of a list.
				<br />
				<br />
				Out center outlet: The rightmost outlet reports a list of the instances where the regular expression matched portions of the subject string.
				<br />
				<br />
				Out center-right outlet: The rightmost outlet passes the original input, in the case that not match occurs.
				<br />
				<br />
				Out right outlet: The rightmost outlet is used to report the values of the object's attributes.
			</description>
		</entry>
	</misc>
</c74object>
