code: function buildLinkNeighbourRegex(string, isTrail) {
  		var regexResult = string.match(stripRegex);
  
  		if (regexResult !== null) {
  			regexResult = regexResult[1].replace(/\(\.\*\??\)/, '');
  			regexResult = convertCodePoints(regexResult);
  		}
  
  		if (regexResult === '()') {
  			// At least zh gives us a linktrail value of /^()(.*)$/sD, which
  			// would match anything. Refuse to use such a non-sense regexp.
  			return null;
  		}
  
  		if (isTrail) {
  			regexResult = '^' + regexResult;
  		} else {
  			regexResult += '$';
  		}
  
  		try {
  			return new RegExp(regexResult);
  		} catch (e) {
  			console.error(e);
  			return null;
  		}
  	}
docs: Helper function for parsing the linktrail/linkprefix regexes