var map = require('map-stream');
var semver = require('semver');

module.exports = function(opts) {
  if(!opts) opts = {};
  if(!semver.inc('0.0.1', opts.type)) opts.type = false;
  // Map each file to this function
  function modifyContents(file, cb) {
    // Remember that contents is ALWAYS a buffer
    if(file.isNull()) return cb(null, file);
    if(file.isStream()) return cb(new Error('gulp-bump: streams not supported'));

    var regex = /([\'|\"]?version[\'|\"]?[ ]*:[ ]*[\'|\"]?)([\d||A-a|.|-]*)([\'|\"]?)/i;
    var data = file.contents.toString();

    data = data.replace(regex, function(match, prefix, version, suffix){
       var newVersion = semver.inc(version, opts.type || 'patch');
       return prefix + newVersion + suffix;
    });
    file.contents = new Buffer(data);
    cb(null, file);
  }

  // Return a stream
  return map(modifyContents);
};

@@ -436,104 +436,26 @@
 var 
-regex = /(%5B%5C'%7C%5C%22%5D?version%5B%5C'%7C%5C%22%5D?%5B %5D*:%5B %5D*%5B%5C'%7C%5C%22%5D?)(%5B%5Cd%7C%7CA-a%7C.%7C-%5D*)(%5B%5C'%7C%5C%22%5D?)/i;%0A    var data = 
+json = JSON.parse(
 file
@@ -478,99 +478,21 @@
 ng()
+)
 ;
-%0A
 %0A    
-data = data.replace(regex, function(match, prefix, version, suffix)%7B%0A       var newV
+json.v
 ersi
@@ -507,16 +507,21 @@
 ver.inc(
+json.
 version,
@@ -552,94 +552,75 @@
     
-   return prefix + newVersion + suffix;%0A    %7D);%0A    file.contents = new Buffer(data
+file.contents = new Buffer(JSON.stringify(json, null, 2) + '%5Cn'
 );%0A
+%0A
     

use JSON parsing to update version option