Index: c/src/xalanc/XalanEXSLT/XalanEXSLTRegExp.cpp
===================================================================
--- c/src/xalanc/XalanEXSLT/XalanEXSLTRegExp.cpp	(revision 0)
+++ c/src/xalanc/XalanEXSLT/XalanEXSLTRegExp.cpp	(revision 13781)
@@ -0,0 +1,597 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "XalanEXSLTRegExp.hpp"
+
+
+
+#include <xalanc/PlatformSupport/XalanUnicode.hpp>
+
+
+
+#if defined(XALAN_USE_BOOST)
+
+
+
+#include "XalanEXSLTRegExpImpl.hpp"
+
+
+
+#include <boost/regex.hpp>
+
+
+
+#include <xalanc/PlatformSupport/AttributesImpl.hpp>
+#include <xalanc/PlatformSupport/DOMStringHelper.hpp>
+
+
+#include <xalanc/XPath/XObjectFactory.hpp>
+#include <xalanc/XPath/XPathEnvSupportDefault.hpp>
+
+
+
+#include <xalanc/XalanTransformer/XalanDocumentBuilder.hpp>
+
+
+
+#include <xercesc/sax2/ContentHandler.hpp>
+
+
+
+#endif // XALAN_USE_BOOST
+
+
+
+XALAN_CPP_NAMESPACE_BEGIN
+
+
+
+// We require boost to compile the function bodies
+#if defined(XALAN_USE_BOOST)
+
+
+
+XALAN_USING_XERCES(ContentHandler)
+
+
+
+#if !defined(XALAN_NO_STD_NUMERIC_LIMITS)
+static const long s_longMax = 
+	XALAN_STD_QUALIFIER numeric_limits<long>::max();
+#else
+static const long s_longMax =
+	LONG_MAX;
+#endif
+
+
+
+static const XalanDOMChar	s_rootNodeName[] =
+{
+    XalanUnicode::charLetter_r,
+    XalanUnicode::charLetter_o,
+    XalanUnicode::charLetter_o,
+    XalanUnicode::charLetter_t,
+    0
+};
+
+
+
+static const XalanDOMChar	s_matchNodeName[] =
+{
+	XalanUnicode::charLetter_m,
+	XalanUnicode::charLetter_a,
+	XalanUnicode::charLetter_t,
+	XalanUnicode::charLetter_c,
+	XalanUnicode::charLetter_h,
+	0
+};
+
+
+
+static const XalanDOMChar	s_emptyCharArray[] =
+{
+	0
+};
+
+
+
+static const AttributesImpl s_emptyAttributes(XalanMemMgrs::getDummyMemMgr());
+
+
+
+static void handleError(
+			const boost::regex_error&	e, 
+			XPathExecutionContext&		executionContext,
+			const XalanNode*			context,
+			const LocatorType*			locator)
+{
+	XalanMessages::Codes code;
+	switch (e.code())
+	{
+		case boost::regex_constants::error_collate:
+			code = XalanMessages::EXSLTRegExp_error_collate;
+			break;
+		case boost::regex_constants::error_ctype:
+			code = XalanMessages::EXSLTRegExp_error_ctype;
+			break;
+		case boost::regex_constants::error_escape:
+			code = XalanMessages::EXSLTRegExp_error_escape;
+			break;
+		case boost::regex_constants::error_backref:
+			code = XalanMessages::EXSLTRegExp_error_backref;
+			break;
+		case boost::regex_constants::error_brack:
+			code = XalanMessages::EXSLTRegExp_error_brack;
+			break;
+		case boost::regex_constants::error_paren:
+			code = XalanMessages::EXSLTRegExp_error_paren;
+			break;
+		case boost::regex_constants::error_brace:
+			code = XalanMessages::EXSLTRegExp_error_brace;
+			break;
+		case boost::regex_constants::error_badbrace:
+			code = XalanMessages::EXSLTRegExp_error_badbrace;
+			break;
+		case boost::regex_constants::error_range:
+			code = XalanMessages::EXSLTRegExp_error_range;
+			break;
+		case boost::regex_constants::error_space:
+			code = XalanMessages::EXSLTRegExp_error_space;
+			break;
+		case boost::regex_constants::error_badrepeat:
+			code = XalanMessages::EXSLTRegExp_error_badrepeat;
+			break;
+		case boost::regex_constants::error_complexity:
+			code = XalanMessages::EXSLTRegExp_error_complexity;
+			break;
+		case boost::regex_constants::error_stack:
+			code = XalanMessages::EXSLTRegExp_error_stack;
+			break;
+		default:
+		case boost::regex_constants::error_bad_pattern:
+			code = XalanMessages::EXSLTRegExp_error_bad_pattern;
+			break;
+	}
+
+	// Format the position with the regex
+	XPathExecutionContext::GetAndReleaseCachedString positionData(executionContext);
+	XalanDOMString &positionString = positionData.get();
+	LongToDOMString(static_cast<long>(e.position()), positionString);
+
+	// Get the specific error text
+	XPathExecutionContext::GetAndReleaseCachedString errorDescriptionData(executionContext);
+	XalanDOMString &errorDescription = errorDescriptionData.get();
+	XalanMessageLoader::getMessage(errorDescription, code);
+
+	// Format both bits up as a whole error message
+	XPathExecutionContext::GetAndReleaseCachedString errorMessageData(executionContext);
+	XalanDOMString &errorMessage = errorMessageData.get();
+	XalanMessageLoader::getMessage(
+			errorMessage,
+            XalanMessages::EXSLTRegExpErrorGeneral_2Param,
+            errorDescription,
+			positionString);
+
+	// Throw an appropriate exception
+	executionContext.error(errorMessage, context, locator);
+}
+
+
+
+static void handleError(
+			const XALAN_STD_QUALIFIER exception &e, 
+			XPathExecutionContext&				executionContext,
+			const XalanNode*					context,
+			const LocatorType*					locator)
+{
+	// Transcode std::exception what() -- I think this is a fallback case
+	// and am not entirely sure if it is necessary
+	XPathExecutionContext::GetAndReleaseCachedString exceptionMessageData(executionContext);
+	XalanDOMString &exceptionMessage = exceptionMessageData.get();
+	TranscodeFromLocalCodePage(e.what(), exceptionMessage); 
+
+	// Format it up as a whole error message
+	XPathExecutionContext::GetAndReleaseCachedString errorMessageData(executionContext);
+	XalanDOMString &errorMessage = errorMessageData.get();
+	XalanMessageLoader::getMessage(
+			errorMessage,
+            XalanMessages::EXSLTRegExpErrorGeneral_1Param,
+            exceptionMessage);
+
+	// Throw an appropriate exception
+	executionContext.error(errorMessage, context, locator);
+}
+
+
+
+XObjectPtr
+XalanEXSLTFunctionRegExpMatch::execute(
+			XPathExecutionContext&			executionContext,
+			XalanNode*						context,
+			const XObjectArgVectorType&		args,
+			const LocatorType*				locator) const
+{
+	try
+	{
+		const XObjectArgVectorType::size_type   theSize = args.size();
+
+		if (theSize != 2 && theSize != 3)
+		{
+			XPathExecutionContext::GetAndReleaseCachedString theString(executionContext);
+
+			executionContext.error(getError(theString.get()), context, locator);
+		}
+
+		// Get the regexp flags if present
+		boost::basic_regex<XalanDOMChar>::flag_type flags = 
+			boost::basic_regex<XalanDOMChar>::JavaScript;
+		bool global = false;
+
+		if (theSize == 3)
+		{
+			const XalanDOMString &flagString = args[2]->str();
+			for (XalanDOMString::size_type i = 0; i < flagString.size(); ++i)
+			{
+				if (flagString[i] == XalanUnicode::charLetter_g)
+					global = true;
+				else if (flagString[i] == XalanUnicode::charLetter_i)
+					flags |= boost::basic_regex<XalanDOMChar>::icase;
+			}
+		}
+
+		// Construct the regexp
+		const XalanDOMString &reString = args[1]->str();
+		boost::basic_regex<XalanDOMChar> re(reString.data(), reString.length(), flags);
+
+		// Create a document to hold the output matches
+		XalanDocumentBuilder *theBuilder = executionContext.createDocumentBuilder();
+		ContentHandler *theContentHandler = theBuilder->getContentHandler();
+
+		theContentHandler->startDocument();
+		theContentHandler->startElement(s_emptyCharArray, s_emptyCharArray, s_rootNodeName, s_emptyAttributes);
+
+		// Match using regex_iterator if global; search if not
+		// XXX: is the same as the javascript semantics?
+		const XalanDOMString &theString = args[0]->str();
+
+		if (global)
+		{
+			boost::regex_iterator<const XalanDOMChar *> m1(theString.begin(), theString.end(), re);
+			boost::regex_iterator<const XalanDOMChar *> m2;
+
+			for (; m1 != m2; ++m1)
+			{
+				const boost::match_results<const XalanDOMChar *>& results = *(m1);
+				const XalanDOMChar *start = (*results.begin()).first;
+				const XalanDOMChar *end = (*results.begin()).second;
+
+				theContentHandler->startElement(s_emptyCharArray, s_emptyCharArray, s_matchNodeName, s_emptyAttributes);
+				theContentHandler->characters(start, end - start);
+				theContentHandler->endElement(s_emptyCharArray, s_emptyCharArray, s_matchNodeName);
+			}
+		}
+		else
+		{
+			boost::match_results<const XalanDOMChar *> results;
+			boost::regex_search(theString.begin(), theString.end(), results, re);
+
+			// Build the matches
+			for (boost::match_results<const XalanDOMChar *>::const_iterator it = results.begin(); 
+				 it != results.end(); ++it)
+			{
+				const XalanDOMChar *start = (*it).first;
+				const XalanDOMChar *end = (*it).second;
+
+				theContentHandler->startElement(s_emptyCharArray, s_emptyCharArray, s_matchNodeName, s_emptyAttributes);
+				theContentHandler->characters(start, end - start);
+				theContentHandler->endElement(s_emptyCharArray, s_emptyCharArray, s_matchNodeName);
+			}
+		}
+
+		// Put the results in a nodeset
+		theContentHandler->endElement(s_emptyCharArray, s_emptyCharArray, s_rootNodeName);
+		theContentHandler->endDocument();
+		XPathExecutionContext::BorrowReturnMutableNodeRefList mnl(executionContext);
+		XalanDocument *theDocument = theBuilder->getDocument();
+		for (XalanNode *matchNode = theDocument->getFirstChild()->getFirstChild();
+			 matchNode;
+			 matchNode = matchNode->getNextSibling())
+		{
+			mnl->addNodeInDocOrder(matchNode, executionContext);
+		}
+		assert(mnl->checkForDuplicates(executionContext.getMemoryManager()) == false);
+		mnl->setDocumentOrder();
+		return executionContext.getXObjectFactory().createNodeSet(mnl);
+	}
+	catch (const boost::regex_error &e)
+	{
+		handleError(e, executionContext, context, locator);
+	}
+	catch (const XALAN_STD_QUALIFIER exception &e)
+	{
+		handleError(e, executionContext, context, locator);
+	}
+	// Dummy to satisfy compiler
+	return XObjectPtr();
+}
+
+
+
+XObjectPtr
+XalanEXSLTFunctionRegExpReplace::execute(
+			XPathExecutionContext&			executionContext,
+			XalanNode*						context,
+			const XObjectArgVectorType&		args,
+			const LocatorType*				locator) const
+{
+	try
+	{
+		const XObjectArgVectorType::size_type   theSize = args.size();
+
+		if (theSize != 4)
+		{
+			XPathExecutionContext::GetAndReleaseCachedString theString(executionContext);
+
+			executionContext.error(getError(theString.get()), context, locator);
+		}
+
+		// Get the regexp flags if present
+		boost::basic_regex<XalanDOMChar>::flag_type flags = 
+			boost::basic_regex<XalanDOMChar>::JavaScript;
+		bool global = false;
+
+		const XalanDOMString &flagString = args[2]->str();
+		for (XalanDOMString::size_type i = 0; i < flagString.size(); ++i)
+		{
+			if (flagString[i] == XalanUnicode::charLetter_g)
+				global = true;
+			else if (flagString[i] == XalanUnicode::charLetter_i)
+				flags |= boost::basic_regex<XalanDOMChar>::icase;
+		}
+
+		// Construct the regexp
+		const XalanDOMString &reString = args[1]->str();
+		boost::basic_regex<XalanDOMChar> re(reString.data(), reString.length(), flags);
+
+		// Do the replacement & return the result
+		const XalanDOMString &theString = args[0]->str();
+		const XalanDOMString &theFormat = args[3]->str();
+		XALAN_STD_QUALIFIER basic_string<XalanDOMChar> result = 
+			boost::regex_replace(
+				XALAN_STD_QUALIFIER basic_string<XalanDOMChar>(theString.c_str()), re, 
+				XALAN_STD_QUALIFIER basic_string<XalanDOMChar>(theFormat.c_str()),
+				global ? 
+					boost::regex_constants::format_default : 
+					boost::regex_constants::format_first_only);
+		return executionContext.getXObjectFactory().createString(result.data(), result.length());
+	}
+	catch (const boost::regex_error &e)
+	{
+		handleError(e, executionContext, context, locator);
+	}
+	catch (const XALAN_STD_QUALIFIER exception &e)
+	{
+		handleError(e, executionContext, context, locator);
+	}
+	// Dummy to satisfy compiler
+	return XObjectPtr();
+}
+
+
+
+XObjectPtr
+XalanEXSLTFunctionRegExpTest::execute(
+			XPathExecutionContext&			executionContext,
+			XalanNode*						context,
+			const XObjectArgVectorType&		args,
+			const LocatorType*				locator) const
+{
+	try
+	{
+		const XObjectArgVectorType::size_type   theSize = args.size();
+
+		if (theSize != 2 && theSize != 3)
+		{
+			XPathExecutionContext::GetAndReleaseCachedString theString(executionContext);
+
+			executionContext.error(getError(theString.get()), context, locator);
+		}
+
+		// Get the regexp flags if present
+		boost::basic_regex<XalanDOMChar>::flag_type flags = 
+			boost::basic_regex<XalanDOMChar>::JavaScript;
+
+		if (theSize == 3)
+		{
+			const XalanDOMString &flagString = args[2]->str();
+			for (XalanDOMString::size_type i = 0; i < flagString.size(); ++i)
+			{
+				if (flagString[i] == XalanUnicode::charLetter_i)
+					flags |= boost::basic_regex<XalanDOMChar>::icase;
+			}
+		}
+
+		// Construct the regexp
+		const XalanDOMString &reString = args[1]->str();
+		boost::basic_regex<XalanDOMChar> re(reString.data(), reString.length(), flags);
+
+		// Match using search
+		const XalanDOMString &theString = args[0]->str();
+		boost::match_results<const XalanDOMChar *> results;
+		return executionContext.getXObjectFactory().createBoolean(
+			boost::regex_search(theString.begin(), theString.end(), results, re));
+	}
+	catch (const boost::regex_error &e)
+	{
+		handleError(e, executionContext, context, locator);
+	}
+	catch (const XALAN_STD_QUALIFIER exception &e)
+	{
+		handleError(e, executionContext, context, locator);
+	}
+	// Dummy to satisfy compiler
+	return XObjectPtr();
+}
+
+
+
+#endif // XALAN_USE_BOOST
+
+
+			
+static const XalanDOMChar	s_regExpNamespace[] =
+{
+	XalanUnicode::charLetter_h,
+	XalanUnicode::charLetter_t,
+	XalanUnicode::charLetter_t,
+	XalanUnicode::charLetter_p,
+	XalanUnicode::charColon,
+	XalanUnicode::charSolidus,
+	XalanUnicode::charSolidus,
+	XalanUnicode::charLetter_e,
+	XalanUnicode::charLetter_x,
+	XalanUnicode::charLetter_s,
+	XalanUnicode::charLetter_l,
+	XalanUnicode::charLetter_t,
+	XalanUnicode::charFullStop,
+	XalanUnicode::charLetter_o,
+	XalanUnicode::charLetter_r,
+	XalanUnicode::charLetter_g,
+	XalanUnicode::charSolidus,
+	XalanUnicode::charLetter_r,
+	XalanUnicode::charLetter_e,
+	XalanUnicode::charLetter_g,
+	XalanUnicode::charLetter_u,
+	XalanUnicode::charLetter_l,
+	XalanUnicode::charLetter_a,
+	XalanUnicode::charLetter_r,
+	XalanUnicode::charHyphenMinus,
+	XalanUnicode::charLetter_e,
+	XalanUnicode::charLetter_x,
+	XalanUnicode::charLetter_p,
+	XalanUnicode::charLetter_r,
+	XalanUnicode::charLetter_e,
+	XalanUnicode::charLetter_s,
+	XalanUnicode::charLetter_s,
+	XalanUnicode::charLetter_i,
+	XalanUnicode::charLetter_o,
+	XalanUnicode::charLetter_n,
+	XalanUnicode::charLetter_s,
+	0
+};
+
+
+
+// Only install the functions if boost is available
+#if defined(XALAN_USE_BOOST)
+static const XalanDOMChar	s_matchFunctionName[] =
+{
+	XalanUnicode::charLetter_m,
+	XalanUnicode::charLetter_a,
+	XalanUnicode::charLetter_t,
+	XalanUnicode::charLetter_c,
+	XalanUnicode::charLetter_h,
+	0
+};
+
+
+
+static const XalanDOMChar	s_replaceFunctionName[] =
+{
+	XalanUnicode::charLetter_r,
+	XalanUnicode::charLetter_e,
+	XalanUnicode::charLetter_p,
+	XalanUnicode::charLetter_l,
+	XalanUnicode::charLetter_a,
+	XalanUnicode::charLetter_c,
+	XalanUnicode::charLetter_e,
+	0
+};
+
+
+
+static const XalanDOMChar	s_testFunctionName[] =
+{
+	XalanUnicode::charLetter_t,
+	XalanUnicode::charLetter_e,
+	XalanUnicode::charLetter_s,
+	XalanUnicode::charLetter_t,
+	0
+};
+
+
+
+static const XalanEXSLTFunctionRegExpMatch		s_matchFunction;
+static const XalanEXSLTFunctionRegExpReplace	s_replaceFunction;
+static const XalanEXSLTFunctionRegExpTest		s_testFunction;
+
+
+
+static const XalanEXSLTRegExpFunctionsInstaller::FunctionTableEntry	theFunctionTable[] =
+{
+	{ s_matchFunctionName,		&s_matchFunction},
+	{ s_replaceFunctionName,	&s_replaceFunction},
+	{ s_testFunctionName,		&s_testFunction},
+	{ 0, 0 }
+};
+
+
+
+// Otherwise do nothing
+#else
+static const XalanEXSLTRegExpFunctionsInstaller::FunctionTableEntry	theFunctionTable[] =
+{
+	{ 0, 0 }
+};
+#endif
+
+
+
+void
+XalanEXSLTRegExpFunctionsInstaller::installLocal(XPathEnvSupportDefault&	theSupport)
+{
+	doInstallLocal(s_regExpNamespace, theFunctionTable, theSupport);
+}
+
+
+
+void
+XalanEXSLTRegExpFunctionsInstaller::installGlobal(MemoryManagerType& theManager)
+{
+	doInstallGlobal(theManager, s_regExpNamespace, theFunctionTable);
+
+}
+
+
+
+void
+XalanEXSLTRegExpFunctionsInstaller::uninstallLocal(XPathEnvSupportDefault&	theSupport)
+{
+	doUninstallLocal(s_regExpNamespace, theFunctionTable, theSupport);
+}
+
+
+
+void
+XalanEXSLTRegExpFunctionsInstaller::uninstallGlobal(MemoryManagerType& theManager)
+{
+	doUninstallGlobal(theManager, s_regExpNamespace, theFunctionTable);
+
+}
+
+
+
+XALAN_CPP_NAMESPACE_END
Index: c/src/xalanc/XalanEXSLT/XalanEXSLTRegExp.hpp
===================================================================
--- c/src/xalanc/XalanEXSLT/XalanEXSLTRegExp.hpp	(revision 0)
+++ c/src/xalanc/XalanEXSLT/XalanEXSLTRegExp.hpp	(revision 13781)
@@ -0,0 +1,59 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#if !defined(EXSLT_REGEXP_HEADER_GUARD_1357924680)
+#define EXSLT_REGEXP_HEADER_GUARD_1357924680
+
+
+
+#include <xalanc/XalanEXSLT/XalanEXSLTDefinitions.hpp>
+
+
+
+#include <xalanc/XalanExtensions/XalanExtensions.hpp>
+
+
+
+XALAN_CPP_NAMESPACE_BEGIN
+
+
+
+class XALAN_EXSLT_EXPORT XalanEXSLTRegExpFunctionsInstaller : public XalanExtensionsInstaller
+{
+public:
+
+	static void
+	installLocal(XPathEnvSupportDefault&	theSupport);
+
+	static void
+	installGlobal(MemoryManagerType& theManager);
+
+	static void
+	uninstallLocal(XPathEnvSupportDefault&	theSupport);
+
+	static void
+	uninstallGlobal(MemoryManagerType& theManager);
+
+private:
+
+};
+
+
+
+XALAN_CPP_NAMESPACE_END
+
+
+
+#endif	// EXSLT_REGEXP_HEADER_GUARD_1357924680

Index: c/src/xalanc/XalanEXSLT/XalanEXSLTRegExpImpl.hpp
===================================================================
--- c/src/xalanc/XalanEXSLT/XalanEXSLTRegExpImpl.hpp	(revision 0)
+++ c/src/xalanc/XalanEXSLT/XalanEXSLTRegExpImpl.hpp	(revision 13781)
@@ -0,0 +1,208 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#if !defined(EXSLT_REGEXPIMPL_HEADER_GUARD_1357924680)
+#define EXSLT_REGEXPIMPL_HEADER_GUARD_1357924680
+
+
+
+// We require boost to compile this
+#if defined(XALAN_USE_BOOST)
+
+
+
+#include "XalanEXSLTDefinitions.hpp"
+
+
+
+#include <xalanc/PlatformSupport/XalanMessageLoader.hpp>
+
+
+
+#include <xalanc/XPath/Function.hpp>
+
+
+
+XALAN_CPP_NAMESPACE_BEGIN
+
+
+
+class XALAN_EXSLT_EXPORT XalanEXSLTFunctionRegExpMatch : public Function
+{
+public:
+
+    XalanEXSLTFunctionRegExpMatch()
+    {
+    }
+
+    virtual
+    ~XalanEXSLTFunctionRegExpMatch()
+    {
+    }
+
+    virtual XObjectPtr
+    execute(
+            XPathExecutionContext&          executionContext,
+            XalanNode*                      context,
+            const XObjectArgVectorType&     args,
+            const LocatorType*              locator) const;
+
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+    virtual Function*
+#else
+    virtual XalanEXSLTFunctionRegExpMatch*
+#endif
+    clone(MemoryManagerType&    theManager) const
+    {
+        return XalanCopyConstruct(theManager, *this);
+    }
+
+protected:
+
+    virtual const XalanDOMString&
+    getError(XalanDOMString&    theResult) const
+    {
+        return XalanMessageLoader::getMessage(
+                    theResult,
+                    XalanMessages::EXSLTFunctionAcceptsTwoOrThreeArguments_1Param,
+                    "match");
+    }
+
+private:
+
+    // Not implemented...
+    XalanEXSLTFunctionRegExpMatch&
+    operator=(const XalanEXSLTFunctionRegExpMatch&);
+
+    bool
+    operator==(const XalanEXSLTFunctionRegExpMatch&) const;
+};
+
+
+
+class XALAN_EXSLT_EXPORT XalanEXSLTFunctionRegExpReplace : public Function
+{
+public:
+
+    XalanEXSLTFunctionRegExpReplace()
+    {
+    }
+
+    virtual
+    ~XalanEXSLTFunctionRegExpReplace()
+    {
+    }
+
+    virtual XObjectPtr
+    execute(
+            XPathExecutionContext&          executionContext,
+            XalanNode*                      context,
+            const XObjectArgVectorType&     args,
+            const LocatorType*              locator) const;
+
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+    virtual Function*
+#else
+    virtual XalanEXSLTFunctionRegExpReplace*
+#endif
+    clone(MemoryManagerType&    theManager) const
+    {
+        return XalanCopyConstruct(theManager, *this);
+    }
+
+protected:
+
+    virtual const XalanDOMString&
+    getError(XalanDOMString&    theResult) const
+    {
+        return XalanMessageLoader::getMessage(
+                    theResult,
+                    XalanMessages::EXSLTFunctionTakesFourArguments_1Param,
+                    "replace");
+    }
+
+private:
+
+    // Not implemented...
+    XalanEXSLTFunctionRegExpReplace&
+    operator=(const XalanEXSLTFunctionRegExpReplace&);
+
+    bool
+    operator==(const XalanEXSLTFunctionRegExpReplace&) const;
+};
+
+
+
+class XALAN_EXSLT_EXPORT XalanEXSLTFunctionRegExpTest : public Function
+{
+public:
+
+    XalanEXSLTFunctionRegExpTest()
+    {
+    }
+
+    virtual
+    ~XalanEXSLTFunctionRegExpTest()
+    {
+    }
+
+    virtual XObjectPtr
+    execute(
+            XPathExecutionContext&          executionContext,
+            XalanNode*                      context,
+            const XObjectArgVectorType&     args,
+            const LocatorType*              locator) const;
+
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+    virtual Function*
+#else
+    virtual XalanEXSLTFunctionRegExpTest*
+#endif
+    clone(MemoryManagerType&    theManager) const
+    {
+        return XalanCopyConstruct(theManager, *this);
+    }
+
+protected:
+
+    virtual const XalanDOMString&
+    getError(XalanDOMString&    theResult) const
+    {
+        return XalanMessageLoader::getMessage(
+                    theResult,
+                    XalanMessages::EXSLTFunctionAcceptsTwoOrThreeArguments_1Param,
+                    "test");
+    }
+
+private:
+
+    // Not implemented...
+    XalanEXSLTFunctionRegExpTest&
+    operator=(const XalanEXSLTFunctionRegExpTest&);
+
+    bool
+    operator==(const XalanEXSLTFunctionRegExpTest&) const;
+};
+
+
+
+XALAN_CPP_NAMESPACE_END
+
+
+
+#endif // XALAN_USE_BOOST
+
+
+#endif  // EXSLT_REGEXPIMPL_HEADER_GUARD_1357924680

Index: c/src/xalanc/XalanTransformer/XalanTransformer.cpp
===================================================================
--- c/src/xalanc/XalanTransformer/XalanTransformer.cpp	(revision 13775)
+++ c/src/xalanc/XalanTransformer/XalanTransformer.cpp	(revision 13781)
@@ -73,6 +73,7 @@
 #include <xalanc/XalanEXSLT/XalanEXSLTString.hpp>
 #include <xalanc/XalanEXSLT/XalanEXSLTDateTime.hpp>
 #include <xalanc/XalanEXSLT/XalanEXSLTRandom.hpp>
+#include <xalanc/XalanEXSLT/XalanEXSLTRegExp.hpp>
 
 
 
@@ -1466,6 +1467,7 @@
     XalanEXSLTStringFunctionsInstaller::installGlobal(m_memoryManagement);
     XalanEXSLTDateTimeFunctionsInstaller::installGlobal(m_memoryManagement);
 	XalanEXSLTRandomFunctionsInstaller::installGlobal(m_memoryManagement);
+	XalanEXSLTRegExpFunctionsInstaller::installGlobal(m_memoryManagement);
 }
 
 XalanTransformer::EnsureFunctionsInstallation::~EnsureFunctionsInstallation()
@@ -1480,6 +1482,7 @@
         XalanEXSLTStringFunctionsInstaller::uninstallGlobal(m_memoryManagement);
         XalanEXSLTDateTimeFunctionsInstaller::uninstallGlobal(m_memoryManagement);
 		XalanEXSLTRandomFunctionsInstaller::uninstallGlobal(m_memoryManagement);
+		XalanEXSLTRegExpFunctionsInstaller::uninstallGlobal(m_memoryManagement);
 
 #if defined(XALAN_USE_ICU)
         XPath::uninstallFunction(XPathFunctionTable::s_formatNumber);
Index: c/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf
===================================================================
--- c/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf	(revision 13775)
+++ c/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf	(revision 13781)
@@ -787,6 +787,91 @@
 		<target>The EXSLT function '{0}' accepts three arguments.</target>
 </trans-unit>
 
+<trans-unit id="EXSLTFunctionTakesFourArguments_1Param">
+		<source>The EXSLT function '{0}' requires four arguments.</source>
+		<target>The EXSLT function '{0}' requires four arguments.</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExpErrorGeneral_2Param">
+		<source>Regular expression error: {0} at position {1}.</source>
+		<target>Regular expression error: {0} at position {1}.</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExpErrorGeneral_1Param">
+		<source>Regular expression error: {0}.</source>
+		<target>Regular expression error: {0}.</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_collate">
+		<source>an invalid collating element was specified in a [[.name.]] block</source>
+		<target>an invalid collating element was specified in a [[.name.]] block</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_ctype">
+		<source>an invalid character class name was specified in a [[:name:]] block</source>
+		<target>an invalid character class name was specified in a [[:name:]] block</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_escape">
+		<source>an invalid or trailing escape was encountered</source>
+		<target>an invalid or trailing escape was encountered</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_backref">
+		<source>a back-reference to a non-existant marked sub-expression was encountered</source>
+		<target>a back-reference to a non-existant marked sub-expression was encountered</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_brack">
+		<source>an invalid character set [...] was encountered</source>
+		<target>an invalid character set [...] was encountered</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_paren">
+		<source>mismatched '(' and ')'</source>
+		<target>mismatched '(' and ')'</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_brace">
+		<source>mismatched '{' and '}'</source>
+		<target>mismatched '{' and '}'</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_badbrace">
+		<source>invalid contents of a {...} block</source>
+		<target>invalid contents of a {...} block</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_range">
+		<source>a character range was invalid, for example [d-a]</source>
+		<target>a character range was invalid, for example [d-a]</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_space">
+		<source>out of memory</source>
+		<target>out of memory</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_badrepeat">
+		<source>an attempt to repeat something that can not be repeated - for example a*+</source>
+		<target>an attempt to repeat something that can not be repeated - for example a*+</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_complexity">
+		<source>the expression became too complex to handle</source>
+		<target>the expression became too complex to handle</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_stack">
+		<source>out of program stack space</source>
+		<target>out of program stack space</target>
+</trans-unit>
+
+<trans-unit id="EXSLTRegExp_error_bad_pattern">
+		<source>other unspecified errors</source>
+		<target>other unspecified errors</target>
+</trans-unit>
+
 <trans-unit id="XalanDOMExceptionCaught_1Param">
 		<source>XalanDOMException caught. The code is '{0}'.</source>
 		<target>XalanDOMException caught. The code is '{0}'.</target>

