diff --git a/libraries.api.php b/libraries.api.php
index fe0c241..102320d 100644
--- a/libraries.api.php
+++ b/libraries.api.php
@@ -72,6 +72,8 @@
  *     - cols: (optional) The maximum number of characters per line to take into
  *       account. Defaults to 200. In case of minified or compressed files, this
  *       prevents reading the entire file into memory.
+ *     - capturing_group: (optional) The index of the capturing group. Default
+ *       to the first capturing group (1).
  *     Defaults to an empty array. 'version arguments' must be specified unless
  *     'version' is declared or the specified 'version callback' does not
  *     require any arguments. The latter might be the case with a
diff --git a/libraries.module b/libraries.module
index 62d3d79..8fcfe34 100644
--- a/libraries.module
+++ b/libraries.module
@@ -900,6 +900,7 @@ function libraries_get_version($library, $options) {
     'pattern' => '',
     'lines' => 20,
     'cols' => 200,
+    'capturing_group' => 1,
   );
 
   $file = DRUPAL_ROOT . '/' . $library['library path'] . '/' . $options['file'];
@@ -910,7 +911,7 @@ function libraries_get_version($library, $options) {
   while ($options['lines'] && $line = fgets($file, $options['cols'])) {
     if (preg_match($options['pattern'], $line, $version)) {
       fclose($file);
-      return $version[1];
+      return $version[$options['capturing_group']];
     }
     $options['lines']--;
   }
