I need to check if the string ft-file
is inside my innerHTML variable. It need to be the exact match including the hyphen.
A small aberration shouldn't be a match, for example "ft-file2", should be false, too.
I tried it with a "regex" but I get the wrong result (false). This is the Fiddle and the code.
let text = document.getElementsByClassName("fulltext")[0].innerHTML;
var reg = /^ft-file$/;
if (reg.test(text) == true) {
console.log("true");
} else {
console.log("false")
}
<div class="fulltext">
[test="data/ft-file/images/small/red"]
</div>