は、私は私が/\[\[(\S+)\]\]/
を建てuser.system.first_name
とuser.custom.luid
正規表現を使用して文字間のデータを抽出しますか?
一致させたい[[user.system.first_name]][[user.custom.luid]] blah blah
のような文字列の何かを持っているが、それはuser.system.first_name]][[user.custom.luid
に一致しています。
私が間違っているのは何ですか?
は、私は私が/\[\[(\S+)\]\]/
を建てuser.system.first_name
とuser.custom.luid
正規表現を使用して文字間のデータを抽出しますか?
一致させたい[[user.system.first_name]][[user.custom.luid]] blah blah
のような文字列の何かを持っているが、それはuser.system.first_name]][[user.custom.luid
に一致しています。
私が間違っているのは何ですか?
/\[\[(\S+?)\]\]/
になること。
[^[]+?(?=]])
var s = "[[user.system.first_name]][[user.custom.luid]]",
m = s.match(/[^[]+?(?=]])/g);
document.write("<pre>" + JSON.stringify(m,null,2) + "</pre>") ;
私は/[^[]+?(?=]])/g
は1つの速い正規表現だと思う:あなたは2つの別々の一致が使用が必要な場合は、あなたの正規表現は、/\[\[(\S+?)\]\]/
var str = '[[user.system.first_name]][[user.custom.luid]] blah blah'
var reg = /\[\[(\S+?)\]\]/g,
match, res = [];
while (match = reg.exec(str))
res.push(match[1]);
document.write('<pre>' + JSON.stringify(res, null, 3) + '</pre>');
'/ \ [\ [(\ S +?)をステップ44で完了することが判明\ ] \]/' –
ポー[大括弧で囲まれたテキストを抽出するための正規表現]の重複の可能性(http://stackoverflow.com/questions/2403122/regular-expression-to-extract-text-between-square-brackets) –