Relative Content

Tag Archive for javascriptreactjstypescriptdebuggingmatch

match() not working with regex expression

const contentWithVideo = ` <p><br></p> <video style=”max-width: 50%; height: auto;” controls=””> <source src=”http://chartbeat-datastream-storage.s3.ap-south-1.amazonaws.com/wp-content/uploads/2024/08/1723616374/SampleVideo_1280x720_30mb.mp4″ type=”video/mp4″> Your browser does not support the video tag. </video>`; // Find the <video> tag with its source URL const videoTagRegex = /<video[^>]*>s*<sources+src=[‘”]([^'”]+)[‘”]s+type=[‘”]([^'”]+)[‘”][^>]*>s*</video>/is; // Using exec() to match the content const matchResult = videoTagRegex.exec(contentWithVideo); the code must match the video tag in […]