CFLib.org – Common Function Library Project

ReMatchNoCase(RegEx, txt)

Last updated May 09, 2009

author

John Bartlett

Version: 0 | Requires: CF6 | Library: StrLib

Description:
Provides the ReMatchNoCase function for MX6 and MX7. Not for use on MX8 (built in function).

Return Values:
Returns an array

Example:

ReMatchNoCase("(ABC|DEF|GHI|JKL)","AbCdEfGhIjKl")

Parameters:

Name Description Required
RegEx Regular expression for which to search Yes
txt search string Yes

Full UDF Source:

/**
 * Provides the CF8 ReMatchNoCase functionality in MX6/MX7
 * 
 * @param RegEx      Regular expression for which to search (Required)
 * @param txt      search string (Required)
 * @return Returns an array 
 * @author John Bartlett (jbartlett@strangejourney.net) 
 * @version 0, May 9, 2009 
 */
function ReMatchNoCase(RegEx,Txt)
{
    var MatchList=ArrayNew(1);
    var tmp="";
    var Done=0;
    var StartPos=1;
    Arguments.Txt=Arguments.Txt & " ";

    while (NOT Done) {
        tmp=ReFindNoCase(Arguments.RegEx,Arguments.Txt,StartPos,"true");
        if (tmp.Pos[1] EQ "0") {
            Done=1;
        } else {
            MatchList[ArrayLen(MatchList) + 1]=Mid(Arguments.Txt,tmp.Pos[1],tmp.Len[1]);
            StartPos=tmp.Pos[1] + Tmp.Len[1];
        }
    }
    return MatchList;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson