Regex to match username using negative look aheads? -
i want use regex such i'm given list of matches username there not "." present in name
account name: sasha.grey //bad match
account name: liz.hurley //bad match
account name: sharonstone //match
tried out regex:
account name:\s+(.*?(?!.))
i have tried match on regexbudy , result doesn't work in both cases.
i think vks answer correct.
another way (avoiding lookaheads @ all) match .
, \n
(and whatever character should not in account name
account name:\s+([^.\n]+)$
edit: $
mark end of line (oder end of file - depends on flavor). might want use \n
instead.
maybe want know expression doing:
\s+(.*?(?!.))
is not working because match
\s+
whitespace (one or more occurences).*?
character (one or many, less possible)(?!.)
not any character\n
if wanted ignore literal
.
, have escape (so it's(?!\.)
or(?![.])
- then, still not work since description is: lookahead non literal dot. this, match''
.*?
in every of examples
Comments
Post a Comment