RegEx.Results
-------------

Queries the result from execute.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [RegEx](component_RegEx.md) | [4.4](newinversion44.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "RegEx.Results"; RegExRef ) 

**MBS**( **"RegEx.Results";** /\* Queries the result from execute. \*/  
**$RegExRef**) /\* The reference number for the regular expression returned from [RegEx.Compile](RegExCompile.md).e.g. $regex \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| RegExRef | The reference number for the regular expression returned from [RegEx.Compile](RegExCompile.md). | $regex |

### Result

Returns text or error.

### Description

Queries the result from execute.  
The result are offsets into the text to search. Two for the whole match followed by 2 for each sub pattern.  
### Examples

Loop and find all matches for pattern:

 Set Variable \[ $pattern ; Value: "(USt\\-?ID:?|USt\\-?IdNR\\.?:?|Umsatzsteuer\\-?ID:?|VAT\\-?ID:?)\[\\s\]?(DE)\[\\s\]?(\[0-9\]{9})" \]   
Set Variable \[ $ExecuteOptions ; Value: 0 \]   
Set Variable \[ $CompileOptions ; Value: "caseless" \]   
Set Variable \[ $regex ; Value: MBS ("[RegEx.Compile](RegExCompile.md)"; $Pattern ; $CompileOptions ) \]   
Set Variable \[ $offset ; Value: 0 \]   
  
Loop  
 Set Variable \[ $r ; Value: MBS ("[RegEx.Execute](RegExExecute.md)"; $regex ; RegEx::Text ; $ExecuteOptions ; $offset ) \]   
 Exit Loop If \[ $r &lt; 4 \]   
 Set Variable \[ $s1 ; Value: MBS ("[RegEx.Substring](RegExSubstring.md)"; $RegEx ; 1) \]   
 Set Variable \[ $s2 ; Value: MBS ("[RegEx.Substring](RegExSubstring.md)"; $RegEx ; 2) \]   
 Set Variable \[ $s3 ; Value: MBS ("[RegEx.Substring](RegExSubstring.md)"; $RegEx ; 3) \]   
 Show Custom Dialog \[ $s1 &amp; ¶ &amp; $s2 &amp; ¶ &amp; $s3 \]   
 Exit Loop If \[ MBS ("IsError") \]   
 Set Variable \[ $offset ; $offset + Value: GetAsNumber(GetValue(MBS ("RegEx.Results"; $regex ); 2)) \]   
End Loop  
Set Variable \[ $r ; Value: MBS ("[RegEx.Release](RegExRelease.md)"; $RegEx ) \]  
### See also

- [IsError](IsError.md)
- [RegEx.Compile](RegExCompile.md)
- [RegEx.Execute](RegExExecute.md)
- [RegEx.Release](RegExRelease.md)
- [RegEx.Substring](RegExSubstring.md)

This function checks for a license.

Created 26th October 2014 , last changed 26th April 2023

  
[RegEx.ReplaceAll](RegExReplaceAll.md) - [RegEx.Size](RegExSize.md)

[HTML Version](RegExResults.shtml)