• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

A JavaScript error occurred. SyntaxError: missing } after property list

Explorer ,
Apr 28, 2023 Apr 28, 2023

Copy link to clipboard

Copied

When I change the double quotes in the following code to single quotes, I get an error

before change

script = script.replace(/\"/g, "'");

after change

script = script.replace(/'/g, '\'');

How do I change to single quotes in the correct style

TOPICS
ActionScript , Error , How to

Views

516

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Apr 28, 2023 Apr 28, 2023

Hi,
What do you want to achieve with this regular expression?
If you want to replace all single quotes with double quotes, here's how:

script = script.replace(/'/g, '"')

 

 

 

Votes

Translate

Translate
Engaged ,
Apr 28, 2023 Apr 28, 2023

Copy link to clipboard

Copied

Hi,
What do you want to achieve with this regular expression?
If you want to replace all single quotes with double quotes, here's how:

script = script.replace(/'/g, '"')

 

 

 

- Vlad: UX and graphic design, Flash user since 1998
Member of Flanimate Power Tools team - extensions for character animation

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 28, 2023 Apr 28, 2023

Copy link to clipboard

Copied

I just want to add a little bit. If you want to change all the characters in a string, then instead of replace() you can use .split("").join("")

Example:

 

 

 

script = script.replace(/'/g, '"')
script = script.split("'").join('"') 

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 28, 2023 Apr 28, 2023

Copy link to clipboard

Copied

LATEST

@Multoman 

 

that should be split("originalcharacter").join("replacementcharacter")

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines