regex - Regular expression with positive lookahead/lookbehind -
how can match below strings single regular expression?
this regular expression i've tried: (?<=.+)site(?=.+)
note simpler regular expressions might job, whole point of learn (?<=.+)
, (?=.+)
parts of regular expression do.
locationasite1 locationasitenumber1 locationasitenumber01 locationasite01 locationbsite.01 locationb.site.02 (locationb)site.02 <locationb>site<03>s ..locationb..site<03>
your regex may written as,
(?<=.)site(?=.)
which means, string site
must preceded , followed atleast 1 character.
most languages won't support variable length lookbehind except c#
family.
(?<=.+)site(?=.+)
means substring site
must preceded , followed 1 or more chars. is, match string site
if it's @ middle not if it's present @ start or @ end.
Comments
Post a Comment