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

SDK Javascript replace ignore case string

Engaged ,
Nov 20, 2021 Nov 20, 2021

Hey

Every tutorial/info I find usually uses "modern" javascript, but since PS is rocking one from 1990... I have no idea how to do it :- )

Can any1 let me know how to do a string replace?

 

var key = "hello"
var value = "Hello World"
var final = "Nice"
value.replace(/key/gi,final)

 

does not work.

Any hints?

TIA!

TOPICS
Actions and scripting , SDK , Windows
465
Translate
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 , Nov 20, 2021 Nov 20, 2021
Translate
Adobe
Engaged ,
Nov 20, 2021 Nov 20, 2021
Translate
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
Guide ,
Nov 20, 2021 Nov 20, 2021

you were very close 🙂

var key = new RegExp ("hello", 'ig')
var value = "Hello World"
var finale = "Nice"
value.replace(key,finale)

 

Translate
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
LEGEND ,
Nov 20, 2021 Nov 20, 2021
LATEST

Moderator please add Actions and scripting label to this thread (and delete my post).

Translate
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