const regex = new RegExp('(?:EXPERIENCE|Employment experience)\\s*\\n(.*?)\\n(?:Skills|Education)', 'gmsi')
const str = `xyz
66 Chetwynd Road
UK
Phone - 070040040040
Email - a18@hotmail.co.uk
PERSONAL PROFILE
I am an energetic, hardworking individual who has developed a responsible approach to any
task I undertake or problem I’m presented with. With previous experience in both customer
service and administration, I can skillfully work with others and help with situations I am
faced with in a calm collective manner.
EXPERIENCE
Play Centre
HOST (September 2021- Present)
▪ Working well under pressure, making decisions quickly and strategically
▪ Problem -solving and using initiative
xyz center
Sales Assistant (November 2020 -January 2020)
▪ Interacted with customers ensuring service was welcoming and helpful.
▪ Responded to any queries
Health & Wellness Club - Work Experience
Staff - (January 2020 - February 2020)
▪ Welcomed members into the gym
▪ Ensured all equipment was safe and clean before it was used by members
EDUCATION
September 2021 -2022
University College `;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions