pub fn test(this: &Value, args: &[Value], _: &mut Interpreter) -> ResultValue {
    let arg_str = get_argument::<String>(args, 0)?;
    let mut last_index = from_value::<usize>(this.get_field("lastIndex")).map_err(to_value)?;
    let result = this.with_internal_state_ref(|regex: &RegExp| {
        let result = match regex.matcher.find_at(arg_str.as_str(), last_index) {
            Some(m) => {
                if regex.use_last_index {
                    last_index = m.end();
                }
                true
            }
            None => {
                if regex.use_last_index {
                    last_index = 0;
                }
                false
            }
        };
        Ok(Gc::new(ValueData::Boolean(result)))
    });
    this.set_field_slice("lastIndex", to_value(last_index));
    result
}
/// Search for a match between this regex and a specified string
Search for a match between this regex and a specified string
Search for a match between this regex and a specified string
pub fn test(this: &Value, args: &[Value], _: &mut Interpreter) -> ResultValue {
    let arg_str = get_argument::<String>(args, 0)?;
    let mut last_index = from_value::<usize>(this.get_field("lastIndex")).map_err(to_value)?;
    let result = this.with_internal_state_ref(|regex: &RegExp| {
        let result = match regex.matcher.find_at(arg_str.as_str(), last_index) {
            Some(m) => {
                if regex.use_last_index {
                    last_index = m.end();
                }
                true
            }
            None => {
                if regex.use_last_index {
                    last_index = 0;
                }
                false
            }
        };
        Ok(Gc::new(ValueData::Boolean(result)))
    });
    this.set_field_slice("lastIndex", to_value(last_index));
    result
}
pub fn test ( this : & Value , args : & [ Value ] , _ : & mut Interpreter ) -> ResultValue { let arg_str = get_argument :: < String > ( args , 0 ) ? ; let mut last_index = from_value :: < usize > ( this . get_field ( " " ) ) . map_err ( to_value ) ? ; let result = this . with_internal_state_ref ( | regex : & RegExp | { let result = match regex . matcher . find_at ( arg_str . as_str ( ) , last_index ) { Some ( m ) => { if regex . use_last_index { last_index = m . end ( ) ; } true } None => { if regex . use_last_index { last_index = 0 ; } false } } ; Ok ( Gc :: new ( ValueData :: Boolean ( result ) ) ) } ) ; this . set_field_slice ( " " , to_value ( last_index ) ) ; result }
Search for a match between this regex and a specified string
Search for a match between this regex and a specified string
this
&Value
args
&mut Interpreter
this
&Value
args
&mut Interpreter