File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ use extendr_api::prelude::*;
66extendr_module ! {
77 mod stringer;
88
9+ fn get_boundary_character;
10+ fn get_boundary_linebreak;
11+ fn get_boundary_sentence;
12+ fn get_boundary_word;
13+
914 fn add_s_flag_to_dot;
1015 fn add_m_flag_to;
1116 fn add_x_flag_to;
@@ -23,6 +28,26 @@ extendr_module! {
2328 fn str_bytes_locates;
2429}
2530
31+ #[ extendr]
32+ pub fn get_boundary_character ( ) -> String {
33+ "^\\ w(?s:.)+\\ w$" . to_string ( )
34+ }
35+
36+ #[ extendr]
37+ pub fn get_boundary_word ( ) -> String {
38+ "^\\ b(?s:.)+\\ b$" . to_string ( )
39+ }
40+
41+ #[ extendr]
42+ pub fn get_boundary_linebreak ( ) -> String {
43+ "^(\\ n|\\ r|\\ r\\ n)(?s:.)+(\\ n|\\ r|\\ r\\ n)$" . to_string ( )
44+ }
45+
46+ #[ extendr]
47+ pub fn get_boundary_sentence ( ) -> String {
48+ "^(\\ b|\\ s|\" |!|\\ ?|,|\\ .|'|:|،|-|—|`|\\ |)+(?s:.)*(\\ b|\\ s|\" |!|\\ ?|,|\\ .|'|:|،|-|—|`|\\ |)+$" . to_string ( )
49+ }
50+
2651#[ extendr]
2752pub fn add_s_flag_to_dot ( string : String ) -> String {
2853 string. replace ( "." , "(?s:.)" )
You can’t perform that action at this time.
0 commit comments