Step 3b
Replace final ch (or gh) with c (or g) if in RV (crocch -> crocc)
429369
private function step3b()
    {
        if ($this->searchIfInRv(array('ch')) !== false) {
            $this->word = preg_replace('#(ch)$#u', 'c', $this->word);

        } elseif ($this->searchIfInRv(array('gh')) !== false) {
            $this->word = preg_replace('#(gh)$#u', 'g', $this->word);
        }
    }
821215
def _vcf_alt(base, other_chr, other_pos, isrc, is_first):
    
    if is_first:
        pipe = "[" if isrc else "]"
        out_str = "{base}{pipe}{chr}:{pos}{pipe}"
    else:
        pipe = "]" if isrc else "["
        out_str = "{pipe}{chr}:{pos}{pipe}{base}"
    return out_str.format(pipe=pipe, chr=other_chr, pos=other_pos + 1,
                          base=base)
1291566
function replaceKeys(searchString, replacement) {
  const replacementKeys = {
    COMPONENT_NAME: replacement,
    component_name: replacement.toLowerCase(),
    COMPONENT_CAP_NAME: replacement.toUpperCase(),
    cOMPONENT_NAME: replacement[0].toLowerCase() + replacement.substr(1),
  }

  return Object.keys(replacementKeys).reduce(
    (acc, curr) => {
      if (acc.includes(curr)) {
        const regEx = new RegExp(curr, 'g')
        return acc.replace(regEx, replacementKeys[curr])
      }
      return acc
    },
    searchString
  )
}
962704
def step1c(self):
        
        if self.ends(['y']) and self.vowel_in_stem():
            self.b[self.k] = 'i'
335147
def process_match(match, fixed_text, cur, cur_end):
    """"""
    # Set our tools
    # -- Initial/default value for replace
    replace = True
    # -- Set check cursor depending on match['type']
    if match['type'] == 'prefix':
        chk = cur - 1
    else:
        # suffix
        chk = cur_end
    # -- Set scope based on whether scope is negative
    if match['scope'].startswith('!'):
        scope = match['scope'][1:]
        negative = True
    else:
        scope = match['scope']
        negative = False

    # Let the matching begin
    # -- Punctuations
    if scope == 'punctuation':
        # Conditions: XORd with negative
        if (not ((chk < 0 and match['type'] == 'prefix') or
                 (chk >= len(fixed_text) and match['type'] == 'suffix') or
                 validate.is_punctuation(fixed_text[chk]))
            ^ negative):
            replace = False
    # -- Vowels -- Checks: 1. Cursor should not be at first character
    # -- if prefix or last character if suffix, 2. Character at chk
    # -- should be a vowel. 3. 'negative' will invert the value of 1
    # -- AND 2
    elif scope == 'vowel':
        if (not (((chk >= 0 and match['type'] == 'prefix') or
                  (chk < len(fixed_text) and match['type'] == 'suffix'))
                 and validate.is_vowel(fixed_text[chk]))
            ^ negative):
            replace =  False
    # -- Consonants -- Checks: 1. Cursor should not be at first
    # -- character if prefix or last character if suffix, 2. Character
    # -- at chk should be a consonant. 3. 'negative' will invert the
    # -- value of 1 AND 2
    elif scope == 'consonant':
        if (not (((chk >= 0 and match['type'] == 'prefix') or
                  (chk < len(fixed_text) and match['type'] == 'suffix'))
                 and validate.is_consonant(fixed_text[chk]))
            ^ negative):
            replace = False
    # -- Exacts
    elif scope == 'exact':
        # Prepare cursor for exact search
        if match['type'] == 'prefix':
            exact_start = cur - len(match['value'])
            exact_end = cur
        else:
            # suffix
            exact_start = cur_end
            exact_end = cur_end + len(match['value'])
        # Validate exact find.
        if not validate.is_exact(match['value'], fixed_text, exact_start,
                                 exact_end, negative):
            replace = False
    # Return replace, which will be true if none of the checks above match
    return replace
113911
function transform(args, opts, cb) {
  opts.config.relativeTo = opts.config.relativeTo || process.cwd();
  verbose = opts.config.verbose;

  var oldRequire = args[0];

  // Only look at non-local require statements
  if (oldRequire[0] !== ".") {
    log("Processing", oldRequire, "in", opts.file);
    var pathToRelative = path.relative(path.dirname(opts.file), opts.config.relativeTo);

    // Try and find a matching package
    var pkg = findPackage(opts.config, oldRequire);
    if (pkg) {
      var newRequire = "." + path.sep + path.join(pathToRelative, oldRequire.replace(pkg.name, pkg.src));

      // replace single backslashes with double backslashes for file paths in windows
      newRequire = newRequire.replace(/\\/gi, "/");

      log("Found pkg for", oldRequire, ":", pkg.name);
      log("Mapping to", newRequire);
      return cb(null, "require(\"" + newRequire + "\")");
    }

  }

  // Default behaviour - just return original
  return cb();
}
1174069
private final void step5() {
        if (k == 0)
            return;
        /* for Bug 1 */ 
        switch (sb.charAt(k-1)) {
        case 'a':
            if (ends("al"))
                break;
            return;
        case 'c': 
            if (ends("ance"))
                break;
            if (ends("ence"))
                break;
            return;
        case 'e':
            if (ends("er"))
                break;
            return;
        case 'i':
            if (ends("ic"))
                break;
            return;
        case 'l':
            if (ends("able"))
                break;
            if (ends("ible"))
                break;
            return;
        case 'n':
            if (ends("ant"))
                break;
            if (ends("ement"))
                break;
            if (ends("ment"))
                break;
            /* element etc. not stripped before the m */
            if (ends("ent"))
                break;
            return;
        case 'o':
            if (ends("ion") && j >= 0 && (b[j] == 's' || b[j] == 't'))
                break;
            /* j >= 0 fixes Bug 2 */
            if (ends("ou"))
                break;
            return;
            /* takes care of -ous */
        case 's':
            if (ends("ism"))
                break;
            return;
        case 't': 
            if (ends("ate"))
                break;
            if (ends("iti"))
                break;
            return;
        case 'u':
            if (ends("ous"))
                break;
            return;
        case 'v':
            if (ends("ive"))
                break;
            return;
        case 'z':
            if (ends("ize"))
                break;
            return;
        default:
            return;
        }
        if (m() > 1) k = j;
    }
304419
private function step3()
    {
        $this->word = preg_replace('#(Y)$#u', 'i', $this->word);
        $this->word = preg_replace('#(ç)$#u', 'c', $this->word);
    }
239165
function (ch) {
  if (ch.hasInterval('M3')) {
    return ch.hasInterval('m7') ? 'x' : 'M';
  }

  if (ch.hasInterval('m3')) {
    if (ch.hasInterval('dim5')) {
      return ch.hasInterval('m7') ? 'ø' : 'o';
    }

    return 'm';
  }

  if (ch.hasInterval('P4')) {
    return 's';
  }

  return null;
}
323163
private String replacementFor(String cn) {
        String name = cn;
        String value = null;
        while (value == null && name != null) {
            try {
                value = ResourceBundleHelper.jdkinternals.getString(name);
            } catch (MissingResourceException e) {
                // go up one subpackage level
                int i = name.lastIndexOf('.');
                name = i > 0 ? name.substring(0, i) : null;
            }
        }
        return value;
    }
1294611
function replaceAll(str, find, replace) {
  return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);
}
1022710
private final void step5() {
        if (k == 0) {
            return;
        }
        
        switch (b[k - 1]) {
            case 'a':
                if (endWith("al")) {
                    break;
                }
                return;
            case 'c':
                if (endWith("ance")) {
                    break;
                }
                if (endWith("ence")) {
                    break;
                }
                return;
            case 'e':
                if (endWith("er")) {
                    break;
                }
                return;
            case 'i':
                if (endWith("ic")) {
                    break;
                }
                return;
            case 'l':
                if (endWith("able")) {
                    break;
                }
                if (endWith("ible")) {
                    break;
                }
                return;
            case 'n':
                if (endWith("ant")) {
                    break;
                }
                if (endWith("ement")) {
                    break;
                }
                if (endWith("ment")) {
                    break;
                }
                /* element etc. not stripped before the m */
                if (endWith("ent")) {
                    break;
                }
                return;
            case 'o':
                if (endWith("ion") && j >= 0 && (b[j] == 's' || b[j] == 't')) {
                    break;
                }
                if (endWith("ou")) {
                    break;
                }
                return;
            /* takes care of -ous */
            case 's':
                if (endWith("ism")) {
                    break;
                }
                return;
            case 't':
                if (endWith("ate")) {
                    break;
                }
                if (endWith("iti")) {
                    break;
                }
                return;
            case 'u':
                if (endWith("ous")) {
                    break;
                }
                return;
            case 'v':
                if (endWith("ive")) {
                    break;
                }
                return;
            case 'z':
                if (endWith("ize")) {
                    break;
                }
                return;
            default:
                return;
        }
        if (m() > 1) {
            k = j;
        }
    }
630905
function (path, replace, replacement) {
    var _path = path.replace(replace, replacement).replace(new RegExp('/{2,}', 'giu'), '/');
    return _path !== '' ? _path : '/'
  }
86001
def step1c(self):
        """"""
        if self.ends("y") and self.vowelinstem():
            self.b = self.b[: self.k] + "i" + self.b[self.k + 1 :]
1371503
function replace(root, options, callback) {
	analyser.readDir(root, options, function(err, files) {
		files = _.flatten(files);
		_.each(files, function(file){ 
			fs.readFile(file, 'UTF-8', function(err, data) {
				if(err) {throw err;}
				var i, value;
				for(i=0; i<options.values.length; i++) {
					value = options.values[i];
					if(value === Object(value)) {
						for(var key in value) {
							if(value.hasOwnProperty(key)) {
								data = data.replace(new RegExp('{{'+key+'}}','g'), value[key]);
							}
						}
					}
					fs.writeFile(file, data);
				}
			});
		});	
		if(callback) {
			callback(err, files);
		}
	});
}
49326
def replace_surrogates(self, m):
        """"""

        high, low = ord(m.group(1)), ord(m.group(2))
        return chr((high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000)
822465
def _fixup_cdef_enums(string, reg=re.compile(r"=\s*(\d+)\s*<<\s*(\d+)")):
    """"""

    def repl_shift(match):
        shift_by = int(match.group(2))
        value = int(match.group(1))
        int_value = ctypes.c_int(value << shift_by).value
        return "= %s" % str(int_value)
    return reg.sub(repl_shift, string)