pub struct RegexExtraction {
pub regex: Regex,
pub key: Option<String>,
pub global: bool,
pub transforms: Transforms,
}Expand description
Configuration for regex-based body extraction.
Extracts values using regular expression captures. Supports both named and unnamed capture groups, with optional transformations.
§Examples
use hitbox_http::extractors::body::{RegexExtraction, Transforms};
use regex::Regex;
// Extract order ID from body
let extraction = RegexExtraction {
regex: Regex::new(r#""order_id":\s*"(\w+)""#).unwrap(),
key: Some("order_id".to_string()),
global: false,
transforms: Transforms::None,
};Fields§
§regex: RegexThe regular expression pattern.
key: Option<String>Key name for unnamed captures. Defaults to "body" if None.
global: boolIf true, extract all matches; if false, extract first match only.
transforms: TransformsTransformations to apply to captured values.
Trait Implementations§
Source§impl Clone for RegexExtraction
impl Clone for RegexExtraction
Source§fn clone(&self) -> RegexExtraction
fn clone(&self) -> RegexExtraction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RegexExtraction
impl RefUnwindSafe for RegexExtraction
impl Send for RegexExtraction
impl Sync for RegexExtraction
impl Unpin for RegexExtraction
impl UnwindSafe for RegexExtraction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more