i want to keep an ocurrence but here must be not ones determinated datas. for example, if i wanna capture a word that must be not following by magazine word it would be thus
feyd wrote:Why would it be the same? The first is using basic patterns and metacharacters. The second is using a negative forward assertion. Quite different.
the result is the same to
(?!a) than [^a] ----> Do im mistaken?
but would like that be thus to
(?!\w) than [^\w] and than \W but i guess that not.
A negative lookahead is not exactly the same as a negated character class. The main difference (as far as I know) is that a negated character class still needs to match a character, a character not listed in the class. A negative lookahead doesn't match (or 'consume') a character -- it only matches a position in the string.
A negative lookahead is not exactly the same as a negated character class. The main difference (as far as I know) is that a negated character class still needs to match a character, a character not listed in the class. A negative lookahead doesn't match (or 'consume') a character -- it only matches a position in the string.
Correct Lookaheads and lookbehinds are not actually consuming characters, they are just looking for the presence of them.