# new RegexpOutputWriter(cmd, lock, regexp, flags)
This class extends StandardOutputWriter to provide regex-based output processing. It allows for pattern matching in the output stream and can trigger specific actions based on matched patterns.
A specialized output writer that uses regular expressions to process output.
Parameters:
| Name | Type | Description | 
|---|---|---|
cmd | 
  
  The command string to be executed.  | 
|
lock | 
  
  A PromiseExecutor to control the asynchronous flow.  | 
|
regexp | 
  
  A string or RegExp to match against the output.  | 
|
flags | 
  
  Optional flags for the RegExp constructor, defaults to "g".  | 
Example
```typescript
import { RegexpOutputWriter } from '@decaf-ts/utils';
import { PromiseExecutor } from '@decaf-ts/utils';
// Create a promise executor
const executor: PromiseExecutor<string, Error> = {
  resolve: (value) => console.log(`Resolved: ${value}`),
  reject: (error) => console.error(`Rejected: ${error.message}`)
};
// Create a regexp output writer that matches version numbers
const writer = new RegexpOutputWriter('node --version', executor, /v(\d+\.\d+\.\d+)/);
// Use the writer to handle command output
writer.data('v14.17.0');  // This will automatically resolve with "v14.17.0"
```
    
                    Classes
- RegexpOutputWriter
 This class extends StandardOutputWriter to provide regex-based output processing. It allows for pattern matching in the output stream and can trigger specific actions based on matched patterns.
Members
Methods
# data(chunk)
Calls the parent class data method and then tests the data for a match to potentially resolve the promise.
Processes incoming data chunks.
Parameters:
| Name | Type | Description | 
|---|---|---|
chunk | 
  
  The data chunk to process.  | 
# error(chunk)
Calls the parent class error method and then tests the data for a match to potentially reject the promise.
Processes incoming error chunks.
Parameters:
| Name | Type | Description | 
|---|---|---|
chunk | 
  
  The error chunk to process.  | 
# test(data)
Executes the regular expression on the input data and returns the match result.
Tests the input data against the stored regular expression.
Parameters:
| Name | Type | Description | 
|---|---|---|
data | 
  
  The string to test against the regular expression.  | 
The result of the regular expression execution, or undefined if an error occurs.
# protected testAndReject(data)
Executes the test method and rejects the promise with the first match group if successful.
Tests the data and rejects the promise if a match is found.
Parameters:
| Name | Type | Description | 
|---|---|---|
data | 
  
  The string to test against the regular expression.  | 
# protected testAndResolve(data)
Executes the test method and resolves the promise with the first match group if successful.
Tests the data and resolves the promise if a match is found.
Parameters:
| Name | Type | Description | 
|---|---|---|
data | 
  
  The string to test against the regular expression.  |