index.js
function getStringWithLength(string, find) {
    let obj;
    // if regex then do it regex way
    if(XRegExp.isRegExp(find)) {
      obj = {
        textValue: XRegExp.replace(string, find, '$1', 'one'),
        textLength: XRegExp.match(string, /class/g, 'one')
          .length
      };
      return;
    } else {
      obj = {
        textValue: find,
        textLength: find.length
      };
    }
    return obj;
  }
function getStringWithLength(string, find) {
    let obj;
    // if regex then do it regex way
    if(XRegExp.isRegExp(find)) {
      obj = {
        textValue: XRegExp.replace(string, find, '$1', 'one'),
        textLength: XRegExp.match(string, /class/g, 'one')
          .length
      };
      return;
    } else {
      obj = {
        textValue: find,
        textLength: find.length
      };
    }
    return obj;
  }
function getStringWithLength ( string , find ) { let obj ; // if regex then do it regex way if ( XRegExp . isRegExp ( find ) ) { obj = { textValue : XRegExp . replace ( string , find , '$1' , 'one' ) , textLength : XRegExp . match ( string , / class / g , 'one' ) . length } ; return ; } else { obj = { textValue : find , textLength : find . length } ; } return obj ; }
get the full matched regex string or the string itself along with it's length
get the full matched regex string or the string itself along with it s length