This is an introduction to Dacorbi Pattern Search, a product created by Daniel Corbier. He has written the following article to present a common problem and his innovative solution.
Many people are accustomed to using regular expressions for performing advanced searches. However, regex patterns can get complicated, especially for searching through XML or HTML code. Dacorbi Pattern Search offers a much easier approach. The interactive tutorial that comes with the download covers many techniques. However, you can start performing advanced searches right away just by using a combination of pattern variables (denoted by curly braces) combined with literal text. For instance, in the example below, a search for the Contact_Info element block of code is performed on some XML code:
Although you can already do a lot with simple pattern variables, regex expressions can also be incorporated into a Dacorbi pattern, such as in the following example, which finds only elements that have a name that starts with “Program_”.
Dacorbi Pattern Search (DPS) can also modify text. Compare for instance, a Wikipedia example given for modifying XML code with XSLT, versus the process for doing it with DPS.
We have this input code:
<?xml version="1.0" ?>
<persons>
<person username="JS1">
<name>John</name>
<family-name>Smith</family-name>
</person>
<person username="MI1">
<name>Morka</name>
<family-name>Ismincius</family-name>
</person>
</persons>
We want to transform it to something like this:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<name username="JS1">John</name>
<name username="MI1">Morka</name>
</root>
The XSLT style sheet given in the Wikipedia example to transform the XML code is:
<xsl:template match="/persons">
<root> <xsl:apply-templates select="person"/> </root>
</xsl:template>
<xsl:template match="person">
<name username="{@username}">
<xsl:value-of select="name" />
</name>
</xsl:template>
</xsl:stylesheet>
Compare that with DPS. If you are using XSLT, you must know keywords such as “stylesheet”, “output”, “template”, “value-of”, etc. for this particular example. With DPS on the other hand, what you need to know for this same example is how to cut-and-paste, that pattern variables are denoted by curly braces, and that you can apply several patterns. Basically, you paste the sample input code in the Find box, paste the sample output in the Replace box, remove extraneous text, and replace other text where applicable with pattern variables, like so:
Pattern #1
Pattern #2
Dacorbi Pattern is a new idea with lots of room for improvements. User feedback is needed in order to support further development.
Visit www.darcobi.com.
(which currently redirects to http://www.ucalc.com/dacorbi.html).