@@ -153,25 +153,25 @@ impl UserData for RegexSet {
153153/// Compiles a regular expression.
154154///
155155/// Once compiled, it can be used repeatedly to search, split or replace substrings in a text.
156- pub fn regex_new ( lua : & Lua , re : LuaString ) -> Result < StdResult < Regex , String > > {
156+ pub fn new ( lua : & Lua , re : LuaString ) -> Result < StdResult < Regex , String > > {
157157 let re = re. to_str ( ) ?;
158158 Ok ( Ok ( lua_try ! ( Regex :: new( lua, & re) ) ) )
159159}
160160
161161/// Escapes a string so that it can be used as a literal in a regular expression.
162- pub fn regex_escape ( _: & Lua , text : LuaString ) -> Result < String > {
162+ pub fn escape ( _: & Lua , text : LuaString ) -> Result < String > {
163163 Ok ( regex:: escape ( & text. to_str ( ) ?) )
164164}
165165
166166/// Returns true if there is a match for the regex anywhere in the given text.
167- pub fn regex_is_match ( lua : & Lua , ( re, text) : ( LuaString , LuaString ) ) -> Result < StdResult < bool , String > > {
167+ pub fn is_match ( lua : & Lua , ( re, text) : ( LuaString , LuaString ) ) -> Result < StdResult < bool , String > > {
168168 let re = re. to_str ( ) ?;
169169 let re = lua_try ! ( Regex :: new( lua, & re) ) ;
170170 Ok ( Ok ( re. is_match ( & text. as_bytes ( ) ) ) )
171171}
172172
173173/// Returns all matches of the regex in the given text or nil if there is no match.
174- pub fn regex_match ( lua : & Lua , ( re, text) : ( LuaString , LuaString ) ) -> Result < StdResult < Value , String > > {
174+ pub fn r#match ( lua : & Lua , ( re, text) : ( LuaString , LuaString ) ) -> Result < StdResult < Value , String > > {
175175 let re = re. to_str ( ) ?;
176176 let re = lua_try ! ( Regex :: new( lua, & re) ) ;
177177 match re. captures ( & text. as_bytes ( ) ) {
@@ -189,10 +189,10 @@ pub fn regex_match(lua: &Lua, (re, text): (LuaString, LuaString)) -> Result<StdR
189189/// A loader for the `regex` module.
190190fn loader ( lua : & Lua ) -> Result < Table > {
191191 let t = lua. create_table ( ) ?;
192- t. set ( "new" , lua. create_function ( regex_new ) ?) ?;
193- t. set ( "escape" , lua. create_function ( regex_escape ) ?) ?;
194- t. set ( "is_match" , lua. create_function ( regex_is_match ) ?) ?;
195- t. set ( "match" , lua. create_function ( regex_match ) ?) ?;
192+ t. set ( "new" , lua. create_function ( new ) ?) ?;
193+ t. set ( "escape" , lua. create_function ( escape ) ?) ?;
194+ t. set ( "is_match" , lua. create_function ( is_match ) ?) ?;
195+ t. set ( "match" , lua. create_function ( r#match ) ?) ?;
196196 t. set ( "RegexSet" , lua. create_proxy :: < RegexSet > ( ) ?) ?;
197197 Ok ( t)
198198}
0 commit comments