001    /**
002     * Implements the CFML Function refind
003     */
004    package railo.runtime.functions.string;
005    
006    import org.apache.oro.text.regex.MalformedPatternException;
007    
008    import railo.runtime.PageContext;
009    import railo.runtime.exp.ExpressionException;
010    import railo.runtime.exp.FunctionException;
011    import railo.runtime.ext.function.Function;
012    import railo.runtime.regex.Perl5Util;
013    import railo.runtime.type.Array;
014    
015    public final class REMatch implements Function {
016            
017            public static Array call(PageContext pc , String regExpr, String str) throws ExpressionException {
018                    try {
019                            return Perl5Util.match(regExpr, str, 1, true);
020                    } 
021                    catch (MalformedPatternException e) {
022                            throw new FunctionException(pc,"REMatch",1,"regularExpression",e.getMessage());
023                    }
024            }
025    }