blob: 762edd7183d1e643c97c3fd115a7b665c7c362d8 [file] [log] [blame]
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use regex::Captures;
pub fn capture_name<'a>(capture: &Captures<'a>, name: &str) -> Result<String, &'static str> {
Ok(capture.name(name).ok_or("Regex capture error")?.as_str().trim().to_string())
}