Reputation: 19
I've been trying to replace patterned occurrences from copy pasted 24 page string from PDF, to create array of collected substrings in react.js . The format is as follows:
var result = /(?<= startpoint)(.*)(?=endpoint)/g;
Due to the fact that symbols are included in the string, I am trying to delete '/' symbols from above result.
var symbremoved = result.replace(/[/]/, "");
Yet I get an error saying result.replace is not a function.
Is there a rule that patterned Regular Expressions I have to follow?
Upvotes: 0
Views: 1274
Reputation: 1006
I learned as I'm doing, but the problem is that your result
is not a string, and replace is a string method.
You have to use myString.replaceAll(/myRegex/g, "")
, the g
is important, as you can see in the print bellow.
Upvotes: 1