javascriptに次の文字列があります:
"Hallo OR、I am OR)"
括弧の前のスペースに注意してください。
この「HalloOR、I am)」が欲しい
ので、基本的に最後のORを削除します。私はすべての正規表現の組み合わせを試しましたが、成功しませんでした。
string = string .replace(/OR\s\)/, " )"); //NO
string = string .replace(/OR \)/, " )"); //NO
丸かっこを削除することは機能しますが、ORを追加するとすぐに、運がありません
string = string .replace(/\)/, " )"); //Removes the bracket
string = string .replace(/\s\)/, " )"); //Removes the bracket and the space
http://regexpal.com/でRegEx/OR \ s)/を試しましたが、うまく機能しているので、JavaScriptで試してみませんか?
非常に単純な問題のように感じますが、2時間経ってもまだ迷っています。
ご協力いただきありがとうございます。