|
|
| version 1.28, 2001/04/03 15:25:07 | version 1.29, 2001/04/03 15:35:23 |
|---|---|
| Line 146 struct Replace_action_info { | Line 146 struct Replace_action_info { |
| String *dest; | String *dest; |
| Value *replacement_code; | Value *replacement_code; |
| bool first_time; | bool first_time; |
| const String *post_match; | |
| }; | }; |
| static void replace_row_action(Table& table, Array *row, void *info) { | static void replace_row_action(Table& table, Array *row, void *info) { |
| Replace_action_info& ai=*static_cast<Replace_action_info *>(info); | Replace_action_info& ai=*static_cast<Replace_action_info *>(info); |
| //table+=&row; | //table+=&row; |
| if(ai.first_time) { // begin | if(row) { // begin/middle |
| ai.first_time=false; | if(ai.first_time) { // begin |
| ai.dest->APPEND_CONST("B"); | ai.first_time=false; |
| } | ai.dest->append(*(String *)row->get(0/*pre_match*/), |
| if(row) // middle | String::UL_PASS_APPENDED); |
| } | |
| ai.dest->APPEND_CONST("M"); | ai.dest->APPEND_CONST("M"); |
| else // end | ai.post_match=(String *)row->get(2/*post_match*/); |
| ai.dest->APPEND_CONST("E"); | } else // end |
| ai.dest->append(*ai.post_match, String::UL_PASS_APPENDED); | |
| } | } |
| /** search/replace | /** search/replace |
| Line 206 static void _match(Request& r, const Str | Line 209 static void _match(Request& r, const Str |
| Replace_action_info replace_action_info={ | Replace_action_info replace_action_info={ |
| &dest, | &dest, |
| &replacement_code, | &replacement_code, |
| true | true, |
| &src | |
| }; | }; |
| src.match(&method_name, | src.match(&method_name, |
| r.process(regexp).as_string(), options, | r.process(regexp).as_string(), options, |