node.jsとexpressを使用しています。
次のような文字列があります。
Here is my string but now I need to processString("mystring")
and return the processString("data").
すべての processString を検索して、関数の結果に置き換えたいと考えています。実行する必要がある関数は非同期です。これを行う簡単な方法はありますか?
ありがとう!
node.jsとexpressを使用しています。
次のような文字列があります。
Here is my string but now I need to processString("mystring")
and return the processString("data").
すべての processString を検索して、関数の結果に置き換えたいと考えています。実行する必要がある関数は非同期です。これを行う簡単な方法はありますか?
ありがとう!
あなたの質問は本当に明確ではありません.「なぜ」と「何」があなたの質問に答えるのに役立つかもしれません. 私が理解していることから、次のものを使用できる場合に置き換えたいprocessString("****")
と考えています。****
var str = 'Here is my string but now I need to processString("mystring") and return the processString("data").'
str = str.replace(/processString\(\".*?\"\)/gi, function(match){
return match.replace("processString\(\"", "").replace("\"\)", "")
})
console.log(str);
processString("****")
これは中身と一致します。これがあなたが探していたものであることを願っています!