XForms/Replace Tester

Motivation
You want to build a form that will allow you quickly test replacement regular expressions using XQuery's replace function.

Link to Working Application
Replace Test

Sample Program
 

XQuery Replace Tester
If you are using eXist, just place this file on the server in the same folder as your XForms test driver.

In the example above I used a test folder on the localhost:

Discussion
This shows that you can quickly built tools to teach yourself complex functions like regular expression handling. You can also use the XQuery match function with returns a true/false if the regular expression matches an input string.

There are two variations of this example that are interesting. The first is where you replace the input form with a large text area for doing global replacements of large blocks of text. The second is where you replace the patten input box with a selection list with common replacement patterns.