Capture

Updated: 12/16/2018 by Computer Hope

Capture may refer to any of the following:

1. In computing, the term capture refers to the process of obtaining information and putting it onto a storage device for future reference. For example, when highlighted text is cut or copied, it's captured and placed in the clipboard, allowing the user to paste the information elsewhere.

2. With computer programming and regular expressions, capture is a term used to describe the process of grabbing matched text in parentheses in a regular expression and store it in a variable.

For example, in the below Perl code, the regular expression /([0-9]+)/ captures any numbers contained in the $value variable.

my $value = "Example 1234 text.";
if ($value =~ /([0-9]+)/) { print "I've captured: $1"; }

In the above example, it would return "I've captured: 1234." when running the script. Capturing text like this can be a great way of grabbing and storing only the text you want in a variable.

$1, Copy, Cut, Paste, Programming terms, Software terms