Does RegEx match all occurrences of the character * after * the first occurrence?

For example, if I try to match 'w in the input line

edward woodward

two words w in the second word must be matched, not one in the first word.

I have a suspicion that the solution may include a “negative appearance”, but simply cannot get any working solution.

(I work with Objective-C and regex replaces methods with NSMutableString, but I would also be happy to hear about solutions for any regex implementation.)

+3
source share
2 answers

, ( ), lookbehind ( , .NET).

, , .NET JGSoft

(?<=w.*)w

Objective C, Python, Java ..

, : w:

(?<=w).*

( lookbehind ), w .

lookbehind , w(.*) 1 ($1).

+8

N -th "w" ( N > 1) "X", , :

(?<=w)(.*?)w

:

$1X
+4

All Articles