Skip to content
Advertisement

Replacing String Text That Contains Double Quotes

I have a number series contained in a string, and I want to remove everything but the number series. But the double quotes are giving me errors. Here are examples of the strings and a sample command that I have used. All I want is 127.60-02-15, 127.60-02-16, etc.

JavaScript

I have tried all sorts of methods (e.g., triple double quotes, single quotes, quotes with backslashes, etc.). Here is one inelegant way that still isn’t working because it’s still leaving “>:

JavaScript

Here is what I am working with (more specific code). I’m retrieving the data from an CSV and just trying to clean it up.

JavaScript

Advertisement

Answer

If you add a > in the second replace it is still not elegant but it works:

JavaScript

Alternatively, you could use a regex:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement