match = subject.match(/\b\d+([.,]\d+)*\b(?=\s+results)/i);
if (match != null) {
// matched text: match[0]
// match start: match.index
// capturing group n: match[n]
}
説明:
// \b\d+([.,]\d+)*\b(?=\s+results)
//
// Options: case insensitive
//
// Assert position at a word boundary «\b»
// Match a single digit 0..9 «\d+»
// Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
// Match the regular expression below and capture its match into backreference number 1 «([.,]\d+)*»
// Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
// Note: You repeated the capturing group itself. The group will capture only the last iteration. Put a capturing group around the repeated group to capture all iterations. «*»
// Match a single character present in the list “.,” «[.,]»
// Match a single digit 0..9 «\d+»
// Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
// Assert position at a word boundary «\b»
// Assert that the regex below can be matched, starting at this position (positive lookahead) «(?=\s+results)»
// Match a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.) «\s+»
// Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
// Match the characters “results” literally «results»
"結果に番号検索に" - あなたはあなたの例では、約3999話されていますか?使用する言語を指定すると、より有用な回答が得られます。 – flesk
可能な入力は2つだけですか?期待される成果はどうですか?最後に何を試しましたか? – FailedDev