Finds a match or matches to a regular expression in a buffer, and saves the capture group to a parameter.

ExampleString and Parameter Functions


lr.saveParamRegexp ( {object} );	

JavaScript Object

   bufferToSearch: "<string>",
   bufferSize: <number>,
   regExp: "<search_string>"|{value: "<search_string>", flag: "IC" }, 
   ordinal: "<string>",
   resultParam: "<string>"


Property NameDescription
bufferTosearchThe buffer in which to search for matches. The buffer can contain binary data.
bufferSizeIn bytes.
regExpA regular expression with exactly one capture group.
flagFlag IC means not case sensitive. For example, regExp: |{value: "(r*)", flag: "IC" } matches 'RR' and 'rRr'.

The 1-based location of the match to find. For example, "ordinal=2" finds the second match.

A value of 0 indicates to find all matches and save the capture strings in a parameter array. The symbol All can be used in place of 0. For example, "ordinal=All".

ResultParamThe name of the parameter or parameter array to save the matches in.

lr.saveParamRegexp searches inside a buffer for a match or matches to a regular expression.

If ordinal is an integer greater than 0 and at least that number of matches is found, a parameter is created with the name specified by the ResultParam argument. The value of the parameter is the capture group of the match.

If ordinal is ALL (0) and at least one match is found, a parameter array is created. The values of the parameters are the capture groups of the matches.

The parameter is not created if either no matches are found or if an ordinal value is specified and fewer matches are found. For example, if "ordinal=3" and only 2 matches are found, the parameter is not created.

If there are multiple calls with the same result parameter, each call overwrites the previous value.

The last result parameter value from a call to lr.saveParamRegexp in an iteration persists between iterations. The first call in an iteration overwrites the previous value.

See also: Example of Parameter Array Use.

Return Values

Not applicable


Standard parameterization is not available for this function.

Concept Link IconSee Also


function Action(){
    var bufferToSearch =

    var matchCt, ord;
    var arrayMemberValue;

    lr.saveParamRegexp ({
        bufferToSearch : bufferToSearch,
               bufferSize: bufferToSearch.length,
               resultParam :"reMatchesParam"});

    matchCt = lr.paramarrLen("reMatchesParam");

    lr.message(matchCt + " match(es) found.");

    for (ord=1; ord <= matchCt; ord++){
        arrayMemberValue = lr.paramarrIdx("reMatchesParam",ord);
        lr.message("Member "+ord+" value: "+arrayMemberValue);

    return 0;