Extract data from text files or log files using regular expressions.


Extract data from files with regular expressions.

Extractor scans file line by line. Registred callbacks are notified when a patterm matches current line.

Start extracting stdin :

    var extractor = require('file-extractor');

Using multiple patterns :

    var extractor = require('file-extractor');
        .matches(/regex1/, cb1)
        .matches(/regex2/, cb2)
        .matches(/regex3/, cb3).start();
$ npm install file-extractor


The constructor function creates a new extractor. Optionnaly pass an accumulator as parameters.

Register a new matching pattern and corresponding callback. Each match is notified using call back.

  • First callback parameter is regex.exec result.
  • Second parameter is the accumulator object.

Return value is this to enable method chaining.

Start scanning stream and notify callbacks.


Sent when end of stream is reached.