re.search(r'(?<=test :)[^.s]*',text)
test = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQAB' var regex = /.*?base64(.*?)/g; var match = regex.exec(test); console.log(match[1]);