regex - What does ?: in a regular expression mean? -
this question has reply here:
reference - regex mean? 1 replyplease explain meaning of regular look , groups look generate?
$string =~ m/^(\d*)(?: \d.*?)(\d*)$/ ps: i'm re-factoring perl code java.
it means not capturing group. after successful match first (\d*) captured in $1, , sec in $2, , (?: \d.*?) not captured @ all.
$string =~ m/^(\d*)(?: \d.*?)(\d*)$/ from perldoc perlretut
non-capturing groupings
a grouping required bundle set of alternatives may or may not useful capturing group. if isn't, creates superfluous add-on set of available capture grouping values, within outside regexp. non-capturing groupings, denoted (?:regexp), still allow regexp treated single unit, don't found capturing grouping @ same time.
regex perl regex-group
No comments:
Post a Comment