Regexp

VlaKl

New Member
Apr 26, 2019
23
0
1
Hi
For what \b(?:[1-9][0-9]*)\b ?:
Google told me:
(?:...)
A non-capturing version of regular parentheses. Matches whatever regular expression is inside the parentheses, but the substring matched by the group cannot be retrieved after performing a match or referenced later in the pattern.

, but I didn't understand. Tell us in a simple way please
 

cageek

New Member
Jun 22, 2018
21
11
3
Normally, the expressions in (...) are captured and available to caller somehow. The (?:...) prevents the expression from being captured. E.g., see the difference in 1 and 2:

#!/usr/bin/perl
print "1: " . join(',','abc' =~ /(a)(b)(c)/) ."\n";
print "2: " . join(',','abc' =~ /(a)(?:b)(c)/) ."\n";

Output:
1: a,b,c
2: a,c

 

VlaKl

New Member
Apr 26, 2019
23
0
1
Thank.
What is the difference between \b(?:[1-9][0-9]*)\b and \b([1-9][0-9]*)\b ?