From: <zu...@gm...> - 2023-07-15 03:05:37
|
That would be _.jpg$ to .jpg Or just _.jpg to .jpg Could even work with _. to . On 2023-07-14 16:33, Mario Mey wrote: > > Oh, thanks for the reply! I'm not with the time to report the bug > right now... 😞 > > "My case" was just an example. My real case is to remove the last > character of the name of the file. Eg: > > IMG_1234_.jpg -> IMG_1234.jpg > > What the regex would be? > > > El 14/7/23 a las 16:51, zu...@gm... escribió: >> >> I don't think it ever worked, it's a To Do in the code at line 1036 :) >> >> Someone should open a bug report about this, maybe someone will pick >> it up in the future and fix it. I'm not gonna bother with it as I >> hate GTK code now. >> >> In your case, there is other ways to achieve it. you could replace >> mp4 to mp >> >> Or you can use Replace with Regular expression : replace 4$ with nothing >> >> >> Just for reference, here's the code : >> >> # Insert >> if ( $insert_radio->get_active and $insert_entry->get_text ne >> '' ) { >> my $insert_at = $insert_spin->get_value_as_int(); >> # TODO: There is an off by one insert here. >> # If $insert_at == -1, we should insert the text at the end. >> Not 1 from the end. >> # This is because there is no such thing as "-0". >> if ( $insert_at > length($new_name) or $insert_at < >> (length($new_name)-(length($new_name)*2)) ) { $insert_at = >> length($new_name); } >> my $tmp_string1 = substr( $new_name, 0, $insert_at ); >> my $tmp_string2 = substr( $new_name, $insert_at, >> length($new_name) ); >> $new_name = $tmp_string1 . $insert_entry->get_text . >> $tmp_string2; >> } >> >> # Delete >> elsif ( $delete_radio->get_active ) { >> my $delete_to = $delete_btw2_spin->get_value_as_int(); >> my $delete_from = $delete_btw1_spin->get_value_as_int(); >> # TODO: Same off by one issue as in Insert. >> if ( $delete_to > length($new_name) or $delete_to < >> (length($new_name)-(length($new_name)*2)) ) { $delete_to = >> length($new_name); } >> my $tmp_string1 = substr( $new_name, 0, $delete_from ); >> my $tmp_string2 = substr( $new_name, $delete_to, >> length($new_name) ); >> $new_name = $tmp_string1 . $tmp_string2; >> } >> >> >> >> On 2023-07-12 19:40, Mario Mey wrote: >>> >>> Hi, there. If I want to remove the last character of the file name, >>> I supposed to use negative numbers to achieve that. But, instead of >>> doing that, it duplicate characters. Like this capture: >>> >>> Also, by using positive numbers in the second field, it duplicates >>> that number of characters: >>> >>> Is this a bug? Is there any other way to achieve it? >>> >>> Thanks. >>> >>> >>> >>> _______________________________________________ >>> Gprename-users mailing list >>> Gpr...@li... >>> https://lists.sourceforge.net/lists/listinfo/gprename-users >> >> >> _______________________________________________ >> Gprename-users mailing list >> Gpr...@li... >> https://lists.sourceforge.net/lists/listinfo/gprename-users > > > _______________________________________________ > Gprename-users mailing list > Gpr...@li... > https://lists.sourceforge.net/lists/listinfo/gprename-users |