regexReallyAll

regexReallyAll ( string regex , string _subject , int _numberOfMask , bool[default:true] _afterEndOfMask ) : string[]

Return the mask of a regex for all corresponding instances. The difference with regexAll is that this function handles overlap when you need to put a marker with a mask. The example is more meaningful :)

Example


console( regexReallyAll(/(?si)(^|\s)([0-9,]+)(\s|$)/, "25 14", 2) ) //  -> [25, 14]
console( regexReallyAll(/(?si)(^|\s)([0-9,]+)(\s|$)/, "25 14", 2, false) ) // -> [25, 5, 14, 14, 4]
console( regexAll(/(?si)(^|\s)([0-9,]+)(\s|$)/, "25 14", 2) ) // -> [25] (because after the catching of 25, the cursor is after "25 " so the regex will not catch a second time the first space of the regex)


See also

regex
regexAll
cleanRegexAll

Parameters

regex

The regular expression to apply on _code. See regex for the pattern. It is important to remember to put a mask (...) to capture a substring, because it is not the expression of the regex that will be returned but the sub-mask of number _numberOfMask. If you want the whole thing, make a mask around the whole expression.

_subject (optional)

The string in which regex will be searched. It doesn't have to be HTML code, you can put any kind of text in it. If null it is the page code in a FORPAGE script.

_numberOfMask (optional)

Default:1. Place of the mask in the regex. Masks are defined by brackets. You can create many masks in regular expressions. To find out the mask number, count the number of opening parentheses from the left.

_afterEndOfMask (optional)

If true, the search will continue just after the end of the capture mask, otherwise it will continue just after the start character of the capture mask +1