Skip to main content

Regex

Struct Regex 

Source
pub struct Regex {
Show 13 fields prog: Vec<Inst>, pub ngroups: usize, pub ignorecase: bool, pub multiline: bool, pub dotall: bool, pub global: bool, pub sticky: bool, pub has_indices: bool, pub unicode: bool, pub unicode_sets: bool, pub source: String, pub flags: String, pub group_names: Vec<(String, usize)>,
}

Fields§

§prog: Vec<Inst>§ngroups: usize§ignorecase: bool§multiline: bool§dotall: bool§global: bool§sticky: bool§has_indices: bool

d(hasIndices)フラグ。true なら exec() の結果に各キャプチャの [start,end) 文字インデックスを持つ indices 配列を追加する。

§unicode: bool§unicode_sets: bool§source: String§flags: String§group_names: Vec<(String, usize)>

名前付きキャプチャグループ (?<name>...)(ES2018)の (名前, グループ番号) 一覧。 一つも無ければ空(exec()groups プロパティは undefined になる)。

Implementations§

Source§

impl Regex

Source

pub fn new(pattern: &str, flags: &str) -> Regex

パターンとフラグからコンパイル。失敗時はリテラル一致にフォールバック。

Source

pub fn find_at(&self, subject: &[char], start: usize) -> Option<Match>

start 以降で最初のマッチを探す。

Source

pub fn find_exact_at(&self, subject: &[char], start: usize) -> Option<Match>

y(sticky)フラグ用: start の位置でのみマッチを試みる(前方探索しない)。 通常の find_at と違い、その場所で一致しなければ探索を打ち切って None を返す。

Source

fn try_match_at(&self, subject: &[char], sp: usize) -> Option<Match>

Source

fn run( &self, pc: usize, s: &[char], sp: usize, caps: &mut Vec<isize>, budget: &mut u32, ) -> bool

Auto Trait Implementations§

§

impl Freeze for Regex

§

impl RefUnwindSafe for Regex

§

impl Send for Regex

§

impl Sync for Regex

§

impl Unpin for Regex

§

impl UnsafeUnpin for Regex

§

impl UnwindSafe for Regex

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.