package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)<link rel="canonical" href="(.*?)">`)
var str = `const regex = /"sku": "(.*?)"/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('"sku": "(.*?)"', 'gm')
const str = \`\`<!DOCTYPE html>
<!-- saved from url=(0044)https://www.daz3d.com/karmen-9-hd-pro-bundle -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" class=""><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Karmen 9 HD Pro Bundle | Daz 3D</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<p>Introducing the Karmen 9 HD Pro Bundle. This all-inclusive bundle features a vibrant makeup look, expressions, a curly and braided bun hairstyle, apocalyptic-inspired outfits, Elemental Mage and Shadow Realm attire, and even monstrous poses to immerse ">
<meta name="keywords" content="Karmen 9 HD Pro Bundle">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="robots" content="INDEX,FOLLOW,noai, noimageai">
<link rel="icon" href="https://www.daz3d.com/static/images/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="https://www.daz3d.com/static/images/favicon.ico" type="image/x-icon">
<!--[if lt IE 7]>
<script type="text/javascript">
//<![CDATA[
var BLANK_URL = '/js/blank.html';
var BLANK_IMG = '/js/spacer.gif';
//]]>
</script>
<![endif]-->
<link rel="stylesheet" href="./Karmen 9 HD Pro Bundle _ Daz 3D_files/design-533ce80c63b6085aedc802b14d1faa79.css" about="0">
<link rel="stylesheet" href="./Karmen 9 HD Pro Bundle _ Daz 3D_files/product_zoom-5de5dd875434871413473d85f684dcfc.css" about="1">
<style>
@keyframes spinner {
0% {
transform: translateY(-50%) rotate(0deg);
}
100% {
transform: translateY(-50%) rotate(360deg);
}
}
.spinner::after {
animation: 1.5s linear infinite spinner;
animation-play-state: inherit;
border: solid 3px #cfd0d1;
border-bottom-color: #1c87c9;
border-radius: 50%;
content: "";
height: 20px;
width: 20px;
display: inline-flex;
flex-direction: column;
padding-bottom: 5px;
}
</style>
<script src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/getIds" type="text/javascript" async=""></script><script type="text/javascript" id="www-widgetapi-script" src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/www-widgetapi.js.download" async=""></script><script async="" src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/fbevents.js.download"></script><script type="text/javascript" async="" src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/bat.js.download"></script><script type="text/javascript" async="" src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/pixel.js.download"></script><script type="text/javascript" async="" src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/analytics.js.download"></script><script type="text/javascript" async="" src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/js"></script><script type="text/javascript" async="" src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/destination"></script><script src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/tag.js.download" type="text/javascript" async="" id="cjapitag"></script><script async="" src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/affirm.js.download"></script><script type="text/javascript" async="" src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/0"></script><script src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/core-ed1ca31447e4f2e9bbf6d9ef38afe3c6.js.download"></script>
<style>
@keyframes spinner {
0% {
transform: translateY(-50%) rotate(0deg);
}
100% {
transform: translateY(-50%) rotate(360deg);
}
}
.spinner::after {
animation: 1.5s linear infinite spinner;
animation-play-state: inherit;
border: solid 3px #cfd0d1;
border-bottom-color: #1c87c9;
border-radius: 50%;
content: "";
height: 20px;
width: 20px;
display: inline-flex;
flex-direction: column;
padding-bottom: 5px;
}
</style>
<script src="./Karmen 9 HD Pro Bundle _ Daz 3D_files/zoom-fee76dde1f2c855960b29036b231c115.js.download"></script>
<script type="application/ld+json">{
"brand": {
"name": "Daz 3D",
"@type": "Brand"
},
"@context": "https://schema.org/",
"description": "Introducing the Karmen 9 HD Pro Bundle. This all-inclusive bundle features a vibrant makeup look, expressions, a curly and braided bun hairstyle, apocalyptic-inspired outfits, Elemental Mage and Shadow Realm attire, and even monstrous poses to immerse your character into any narrative from modern desert to fantasy to horror.",
"image": "https://gcdn.daz3d.com/p/91909/i/shimuzu_Karmen_Pro_Bundle.jpg",
"name": "Karmen 9 HD Pro Bundle",
"offers": {
"availability": "https://schema.org/InStock",
"itemCondition": "https://schema.org/NewCondition",
"price": 185.99,
"priceCurrency": "USD",
"@type": "Offer"
},
"sku": "91909",
"@type": "Product"
}</script>
<link rel="canonical" href="https://www.daz3d.com/karmen-9-hd-pro-bundle">
<script>
if (!daz) { var daz = {}; };
daz.api = new DazApi()
from 331.2deg,
var(--border-color-1),
var(--border-color-2),
var(--border-color-1),
var(--border-color-2),
var(--border-color-1)
)
1;
}
93% {
border-image: conic-gradient(
from 334.8deg,
var(--border-color-1),
var(--border-color-2),
var(--border-color-1),
var(--border-color-2),
var(--border-color-1)
)
1;
}
94% {
border-image: conic-gradient(
from 338.4deg,
var(--border-color-1),
var(--border-color-2),
var(--border-color-1),
var(--border-color-2),
var(--border-color-1)
)
1;
}
95% {
border-image: conic-gradient(
from 342deg,
var(--border-color-1),
var(--border-color-2),
var(--border-color-1),
var(--border-color-2),
var(--border-color-1)
)
1;
}
96% {
border-image: conic-gradient(
from 345.6deg,
var(--border-color-1),
var(--border-color-2),
var(--border-color-1),
var(--border-color-2),
var(--border-color-1)
)
1;
}
97% {
border-image: conic-gradient(
from 349.2deg,
var(--border-color-1),
var(--border-color-2),
var(--border-color-1),
var(--border-color-2),
var(--border-color-1)
)
1;
}
98% {
border-image: conic-gradient(
from 352.8deg,
var(--border-color-1),
var(--border-color-2),
var(--border-color-1),
var(--border-color-2),
var(--border-color-1)
)
1;
}
99% {
border-image: conic-gradient(
from 356.4deg,
var(--border-color-1),
var(--border-color-2),
var(--border-color-1),
var(--border-color-2),
var(--border-color-1)
)
1;
}
100% {
border-image: conic-gradient(
from 360deg,
var(--border-color-1),
var(--border-color-2),
var(--border-color-1),
var(--border-color-2),
var(--border-color-1)
)
1;
}
}
}
/* END rotate bonus box border */
/* BEGIN falling stars animation */
.bg-stars {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
}
.bg-stars .bg-star {
font-size: 1em;
position: absolute;
top: -25px;
color: yellow;
user-select: none;
cursor: default;
text-shadow: 0 0 1px #000;
animation-name: fallingStars;
animation-duration: 5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-play-state: running;
z-index: -1;
}
.bg-stars .bg-star:nth-of-type(1) {
left: 10%;
-webkit-animation-delay: 1s, 1s;
animation-delay: 1s, 1s;
}
.bg-stars .bg-star:nth-of-type(2) {
left: 20%;
</div></body></html>(\`;
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}\`);
});
}
`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
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 Golang, please visit: https://golang.org/pkg/regexp/