Still getting used to lookarounds in regex, but can't seem to get
\b(?>! key)foreign\b
To be the right solution? I'm trying to find all instances of the word foreign in some text, but NOT foreign key or foreignkey.
How about: \\bforeign(?!\\s?key)\\b
Example: http://regexr.com?343k9
The lookahead needs to be after foreign
(and you don't need the >
):
\bforeign(?! key)\b
The word boundary will handle the foreignkey
case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.