Skip to main content

rivescript_core/
regex.rs

1use regex::Regex;
2use lazy_static::lazy_static;
3
4lazy_static! {
5    /// {weight=100}
6    pub static ref WEIGHT: Regex = Regex::new(r"\{weight=(\d+?)\}").unwrap();
7    pub static ref INHERITS: Regex = Regex::new(r"\{inherits=(\d+)\}").unwrap();
8    pub static ref TRIGGER_OPTIONALS: Regex = Regex::new(r"\[(.+?)\]").unwrap();
9    pub static ref TRIGGER_ARRAY: Regex = Regex::new(r"@(.+?)\b").unwrap();
10    pub static ref REPLY_ARRAY: Regex = Regex::new(r"\(@([A-Za-z0-9_]+)\)").unwrap();
11    pub static ref REPLY_ARRAY_DUMMIED: Regex = Regex::new(r"\x00@([A-Za-z0-9_]+)\x00").unwrap();
12    pub static ref RANDOM_TAG: Regex = Regex::new(r"\{random\}(.+?)\{/random\}").unwrap();
13    pub static ref PERSON_TAG: Regex = Regex::new(r"\{person\}(.+?)\{/person\}").unwrap();
14    pub static ref FORMAL_TAG: Regex = Regex::new(r"\{formal\}(.+?)\{/formal\}").unwrap();
15    pub static ref SENTENCE_TAG: Regex = Regex::new(r"\{sentence\}(.+?)\{/sentence\}").unwrap();
16    pub static ref UPPERCASE_TAG: Regex = Regex::new(r"\{uppercase\}(.+?)\{/uppercase\}").unwrap();
17    pub static ref LOWERCASE_TAG: Regex = Regex::new(r"\{lowercase\}(.+?)\{/lowercase\}").unwrap();
18    pub static ref TOPIC_TAG: Regex = Regex::new(r"\{topic=(.+?)\}").unwrap();
19    pub static ref REDIRECT_TAG: Regex = Regex::new(r"\{@(.+?)\}").unwrap();
20    pub static ref ANY_TAG: Regex = Regex::new(r"<([^<]+?)>").unwrap();
21    pub static ref BOT_TAG: Regex = Regex::new(r"<bot (.+?)>").unwrap();
22    pub static ref USER_VAR_TAG: Regex = Regex::new(r"<get (.+?)>").unwrap();
23    pub static ref HISTORY_TAG: Regex = Regex::new(r"<(?:input|reply)(\d+?)>").unwrap();
24    pub static ref CALL_TAG: Regex = Regex::new(r"<call>(.+?)</call>").unwrap();
25    pub static ref NASTIES: Regex = Regex::new(r"[^A-Za-z0-9 ]").unwrap();
26    pub static ref META_CHARACTERS: Regex = Regex::new(r"[\\<>]+").unwrap();
27    pub static ref SYMBOLS: Regex = Regex::new(r"[.?,!;:@#$%^&*()]+").unwrap();
28    pub static ref ZERO_WIDTH_STAR: Regex = Regex::new(r"^\*$").unwrap();
29    pub static ref CONDITION: Regex = Regex::new(r"^(.+?)\s+(==|eq|!=|ne|<>|<|<=|>|>=)\s+(.*?)$").unwrap();
30    pub static ref PLACEHOLDER: Regex = Regex::new(r"\x00(\d+)\x00").unwrap();
31}