<commit_before>function groupBy(array, f) {
	var groups = {};
	array.forEach((o) => {
		var group = JSON.stringify(f(o));
		groups[group] = groups[group] || [];
		groups[group].push(o);
	});
	return Object.keys(groups).map((group) => {
		return groups[group];
	});
}

const regEx = (str) => {
	let convertedString = str.replace(/\s/g, '');
	return convertedString;
};

$(document).ready(() => {
	$('#download-button').click(() => {
		$('html, body').animate({
			scrollTop: $('#scroll-here').offset().top
		}, 2000);
	});
	$.ajax({
		url: '/api',
		type: 'GET',
		dataType: 'JSON'
	}).done((response) => {
		console.log(response);
		if (!response.items || response.items.length === 0) {
			$('#calendarFill').append('<div class="row"><div class="col s12 center"><h3 class="brown-text">Upcoming Productions listed here</h3></div></div>');
			return;
		}
		let operas = groupBy(response.items, (item) => {
			return [item.summary];
		});
		for (let i = 0; i < operas.length; i++) {
			$('#calendarFill').append('<div class="row" id="' + regEx(operas[i][0].summary) + '"><div class="col s12 center"><h5 class="brown-text">' + operas[i][0].summary + '</h5></div></div>');
			let activeID = operas[i];
			for (let k = 0; k < activeID.length; k++) {
				$('#' + regEx(activeID[k].summary)).append('<div class="col s12 m6 l4 center calendar-ajax ' +
					regEx(activeID[k].summary) + '"><div class="card teal lighten-1 z-depth-2 text-black"><div class="card-content white-text"><span class="card-title">' + activeID[k].summary + '</span><p class="calendar-date">' + moment(activeID[k].start.dateTime, moment.ISO_8601).format('MMM-DD-YYYY', 'en') +
					'</p><p class="calendar-time">' + moment(activeID[k].start.dateTime, moment.ISO_8601).format('hh:mm a') +
					'</p><div class="card-action"><a class="btn waves-effect waves-light brown lighten-1" href="' + activeID[k].description +
					'">Info and Tickets</a></div></div></div>');
			}
		}
	});
});<commit_msg>added regex for string parsing<commit_after>function groupBy(array, f) {
	var groups = {};
	array.forEach((o) => {
		var group = JSON.stringify(f(o));
		groups[group] = groups[group] || [];
		groups[group].push(o);
	});
	return Object.keys(groups).map((group) => {
		return groups[group];
	});
}

const regExID = (str) => {
	let convertedString = str.replace(/[^\w\.@-]/g,'');
	return convertedString;
};

const regExURL = (str) => {
	let convertedString = str.match(/((\w+:\/\/)[-a-zA-Z0-9:@;?&=\/%\+\.\*!'\(\),\$_\{\}\^~\[\]`#|]+)/g);
	return convertedString[0];
}

const regExNoURL = (str) => {
	const conv = str.split(/((\w+:\/\/)[-a-zA-Z0-9:@;?&=\/%\+\.\*!'\(\),\$_\{\}\^~\[\]`#|]+)/g);
	return conv[0];
}

$(document).ready(() => {
	$('#download-button').click(() => {
		$('html, body').animate({
			scrollTop: $('#scroll-here').offset().top
		}, 2000);
	});
	$.ajax({
		url: '/api',
		type: 'GET',
		dataType: 'JSON'
	}).done((response) => {
		if (!response.items || response.items.length === 0) {
			$('#calendarFill').append('<div class="row"><div class="col s12 center"><h3 class="brown-text">Upcoming Productions listed here</h3></div></div>');
			return;
		}
		let operas = groupBy(response.items, (item) => {
			return [item.summary];
		});
		for (let i = 0; i < operas.length; i++) {
			$('#calendarFill').append('<div class="row" id="' + regExID(operas[i][0].summary) + '"><div class="col s12 center"><h5 class="brown-text">' + operas[i][0].summary + '</h5><p>' + regExNoURL(operas[i][0].description) + '</p></div></div>');
			let activeID = operas[i];
			for (let k = 0; k < activeID.length; k++) {
				$('#' + regExID(activeID[k].summary)).append('<div class="col s12 m6 l4 center calendar-ajax ' +
					regExID(activeID[k].summary) + '"><div class="card teal lighten-1 z-depth-2 text-black"><div class="card-content white-text"><span class="card-title">' + activeID[k].summary + '</span><p class="calendar-date">' + moment(activeID[k].start.dateTime, moment.ISO_8601).format('MMM-DD-YYYY', 'en') +
					'</p><p class="calendar-time">' + moment(activeID[k].start.dateTime, moment.ISO_8601).format('hh:mm a') +
					'</p><p><div class="card-action"><a class="btn waves-effect waves-light brown lighten-1" href="' + regExURL(activeID[k].description) +
					'">Info and Tickets</a></div></div></div>');
			}
		}
	});
});
{'fraction_non_alphanumeric': 0.2630475302889096, 'fraction_numerical': 0.016542404473438955, 'mean_word_length': 4.280442804428044, 'pattern_counts': {'":': 0, '<': 64, '<?xml version=': 0, '>': 76, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4081324', 'n_tokens_mistral': 1714, 'n_tokens_neox': 1570, 'n_words': 277}