Constructor
new RegexParser()
- Source:
Example
To use the `Regex` parser provide a regular expression to split the incoming text upon. Data is emitted as string controllable by the `encoding` option (defaults to `utf8`).
```js
const SerialPort = require('serialport');
const Regex = SerialPort.parsers.Regex;
const port = new SerialPort('/dev/tty-usbserial1');
const parser = port.pipe(new Regex({ regex: /[\r\n]+/ }));
parser.on('data', console.log);
```
Extends
- Transform