handleRegExEntity = function(parsedContent, entityName, entityType, entityRoles, range) {
    // check if this regex entity is already labelled in an utterance and or added as a simple entity. if so, throw an error.
    try {
        let rolesImport = VerifyAndUpdateSimpleEntityCollection(parsedContent, entityName, 'RegEx');
        if (rolesImport.length !== 0) {
            rolesImport.forEach(role => !entityRoles.includes(role) ? entityRoles.push(role) : undefined);
        }
    } catch (err) {
        throw (err);
    }
    let regex = '';
    // handle regex entity 
    if (entityType) {
        regex = entityType.slice(1, entityType.length - 1);
        if (regex === '') {
            let errorMsg = `RegEx entity: ${entityName} has empty regex pattern defined.`;
            let error = BuildDiagnostic({
                message: errorMsg,
                range: range
            })

            throw (new exception(retCode.errorCode.INVALID_REGEX_ENTITY, error.toString(), [error]));
        }
    }
    
    // add this as a regex entity if it does not exist
    let regExEntity = (parsedContent.LUISJsonStructure.regex_entities || []).find(item => item.name == entityName);
    if (regExEntity === undefined) {
        parsedContent.LUISJsonStructure.regex_entities.push(new helperClass.regExEntity(entityName, regex, entityRoles))
    } else {
        // throw an error if the pattern is different for the same entity
        if (regExEntity.regexPattern !== '' && regex !== '' && regExEntity.regexPattern !== regex) {
            let errorMsg = `RegEx entity: ${regExEntity.name} has multiple regex patterns defined. \n 1. /${regex}/\n 2. /${regExEntity.regexPattern}/`;
            let error = BuildDiagnostic({
                message: errorMsg,
                range: range
            })

            throw (new exception(retCode.errorCode.INVALID_REGEX_ENTITY, error.toString(), [error]));
        } else {
            // update roles
            addItemOrRoleIfNotPresent(parsedContent.LUISJsonStructure, LUISObjNameEnum.REGEX, regExEntity.name, entityRoles);
            // add regex pattern
            if (regExEntity.regexPattern === '') regExEntity.regexPattern = regex;
        }
    }
}
@param {Object} parsedContent Object containing the parsed structure - LUIS, QnA, QnA alterations
@param {String} entityName name of entity
@param {String} entityType type of entity
@param {String []} entityRoles array of entity roles found
@param {String} range range