function isStringBefore(before) {
  const result = { is: false, opsBetween: false };
  const stringOpsClipped = before.replace(/(\s*[+/*%]|\s+-)+$/, "");

  if (stringOpsClipped !== before) {
    result.opsBetween = true;
  }

  // If it is quoted
  if (
    stringOpsClipped[stringOpsClipped.length - 1] === '"' ||
    stringOpsClipped[stringOpsClipped.length - 1] === "'"
  ) {
    result.is = true;
  } else if (
    stringOpsClipped.search(
      /(?:^|[/(){},: ])([a-zA-Z_][\w-]*|-+[a-zA-Z_][\w-]*)$/
    ) !== -1
  ) {
    // First pattern: a1, a1a, a-1,
    result.is = true;
  }

  return result;
}
Checks if there is a string before the character.
Also checks if there is a math operator in between

@param {String} before - the input string that preceses the character
@return {Object} return
   {Boolean} return.is - if there is a string
   {String} return.opsBetween - if there are operators in between