I have below code and i am trying to replace regex with another text but it is not working any suggestion what. i am doing wrong?
const regex = /\?/g;
let p = document.querySelectorAll('.test');
p.forEach((pa) => {
pa.style.color = 'red';
pa.innerHTML.replace(regex, 'test');
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p class="test">This one was, hopefully, quite straightforward although? it did get a bit more complicated as a? previous exercise had created multiple paragraph tags on the page. It’s a good bit of string! manipulation practice too.Got your own solution for this?;</p>
</body>
<script src="app2.js"></script>
</html>