Re: regexp ?:
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: regexp ?:

From: Bryan Oakley <oakley@bardo.clearlight.com>
Date: Wed Dec 28 2005 - 20:09:54 CET

Andre Arpin wrote:
> What is the ?: use for could someone give an example of it usage
>
>

Normally, (...) captures everything inside the ()'s and saves them to a
variable. Using ?: allows (...) to do the grouping that it normally
does, but doesn't capture the results.

% regexp {Hello, (.*)} "Hello, World" a b
1
% puts "b='$b'"
b='World'
% regexp {Hello, (?:.*)} "Hello, World" a b
1
% puts "b='$b'"
b=''
%
Received on Tue Jan 3 03:09:27 2006