Regular expression blocks

RegEx Matcher and Replacer Example

This Specification example shows how to use the regex-matcher and a regex-replacer block.

<?xml version="1.0" encoding="UTF-8"?>
<specification xmlns="http://www.touchatag.com/schema/configurator/specification-1.0">
    <application>
        <command id="default" name="Match with regex"/>
    </application>
    <blueprint>
		<superblock id="regex-usage">
			<breakdown>
				<block id="text4matching" ref="urn:touchatag:block:text-source">
					<property name="Value">
						<text>We are the knights who say, Ni! Ni! Ni!</text>
					</property>
				</block>
				<block id="regex4matching" ref="urn:touchatag:block:text-source">
					<property name="Value">
						<text>(Ni!)</text>
					</property>
				</block>
				<block id="matcher" ref="urn:touchatag:block:regex-matcher"/>
				<block id="replacer" ref="urn:touchatag:block:regex-replacer"/>
				<block id="text4output" ref="urn:touchatag:block:text-source">
					<property name="Value">
						<text>Matches found : &size;</text>
					</property>
				</block>
				<block id="regex4replacement" ref="urn:touchatag:block:text-source">
					<property name="Value">
						<text>(&size;)</text>
					</property>
				</block>
				<block id="int2text" ref="urn:touchatag:block:integer-to-text"/>
				<block id="message" ref="urn:touchatag:block:message"/>
			</breakdown>
			<wiringscheme>
				<wire from="text4matching:out" to="matcher:text-in"/>
				<wire from="regex4matching:out" to="matcher:regex-in"/>
				<wire from="matcher:size-out" to="int2text:in"/>
				<wire from="text4output:out" to="replacer:text-in"/>
				<wire from="regex4replacement:out" to="replacer:regex-in"/>
				<wire from="int2text:out" to="replacer:replacement-in"/>
				<wire from="replacer:out" to="message:in"/>
				<shunt from="message:out" to="action-out"/>
			</wiringscheme>
		</superblock>
    </blueprint>
    
</specification>

This example uses the following blocks :