I want the Perl regex to match std::foo, but not to match std::foo::bar. This is what I have so far:
std::foo
std::foo::bar
/((?<!\w)([A-Za-z0-9_]+)::([A-Za-z0-9_]+))(?!:)/
This matches std::foo::barup to std::fo, but I want the whole match to fail for this input, rather than giving a partial match.
std::fo
What regular expression do I need?
foo \w++. , "" , - - . , - :, baz::std::foo
foo
\w++
:
baz::std::foo
. \w , /x .
\w
/x
use strict; use warnings 'all'; use feature 'say'; my $s = 'match std::foo but not match std::foo::bar.'; say $1 while $s =~ / (?<![\w:]) ( \w+::\w++) (?!:) /gx;
\b , , exisst, : . .
\b
((?<![:\w])([A-Za-z0-9_]+)::([A-Za-z0-9_]+))\b(?!:)
, .
(?<!\S)([A-Za-z0-9_]+)::([A-Za-z0-9_]+)\b(?!:)
DEMO
\b :
((?<!\w)([A-Za-z0-9_]+)::([A-Za-z0-9_]++))(?!:)
((?<!\w)([A-Za-z0-9_]+)::([A-Za-z0-9_]+))(?![:\w])
((\b(.+)\b)+?[::]{2}.+)
Source: https://habr.com/ru/post/1670733/More articles:Nodejs passport with local token with Mysql - node.jsGoogle Places API - Angular 2 / Typescript / Ionic 2 - angularHow can I tell ReSharper that I am using a shell for Debug.Assert to avoid empty ref links? - c #Angular2 - ngZone - google.maps does not trigger change detection - angularhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1670731/android-studio-the-debugger-detaches-but-the-app-stops-too&usg=ALkJrhj0pOA6zLjrAUMo-o17AK30T0QoPQWhat is the meaning of undefined behavior? - c ++Cloudformation: VPC routing table without route for internet gateway - amazon-web-servicesКак использовать редактор геометрии Eclipse ICE? - eclipseTensorflow: using session / graph method in a method - pythonNested resources: Missing required parameters (laravel) - phpAll Articles