correspond à cette expression abcbcabc mais pas aabbcc
// (?:(\w)(?!\1))+
//
// Match the regular expression below «(?:(\w)(?!\1))+»
// 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 «(\w)»
// Match a single character that is a “word character” (letters, digits, etc.) «\w»
// Assert that it is impossible to match the regex below starting at this position (negative lookahead) «(?!\1)»
// Match the same text as most recently matched by capturing group number 1 «\1»
Modifier
comme cela a été expliqué dans les commentaires, les limites de chaîne font matière. La regex devient alors
\m(?:(\w)(?!\1))+\M
Félicitations à Gumbo.
devoirs va bien? – Benjol