@@ -1291,10 +1291,10 @@ convert_filename_to_human_name() {
12911291 local capitalized=$( echo " $lowercase " | awk ' {print toupper(substr($0,1,1)) tolower(substr($0,2))}' )
12921292
12931293 # Replace all variations with the uppercase acronym
1294- # Use [[:<:]] and [[:>:]] for BSD sed word boundaries
1295- name=$( echo " $name " | sed -E " s/[[:<:]] $lowercase [[:>:]] /$acronym /g" )
1296- name=$( echo " $name " | sed -E " s/[[:<:]] $capitalized [[:>:]] /$acronym /g" )
1297- name=$( echo " $name " | sed -E " s/[[:<:]] $acronym [[:>:]] /$acronym /g" )
1294+ # Use Perl for portable word boundary matching (\b works consistently across platforms)
1295+ name=$( echo " $name " | perl -pe " s/\\ b $lowercase \\ b /$acronym /g" )
1296+ name=$( echo " $name " | perl -pe " s/\\ b $capitalized \\ b /$acronym /g" )
1297+ name=$( echo " $name " | perl -pe " s/\\ b $acronym \\ b /$acronym /g" )
12981298 done
12991299
13001300 echo " $name "
@@ -1327,10 +1327,10 @@ convert_filename_to_human_name_capitalized() {
13271327 local capitalized=$( echo " $lowercase " | awk ' {print toupper(substr($0,1,1)) tolower(substr($0,2))}' )
13281328
13291329 # Replace all variations with the uppercase acronym
1330- # Use [[:<:]] and [[:>:]] for BSD sed word boundaries
1331- name=$( echo " $name " | sed -E " s/[[:<:]] $lowercase [[:>:]] /$acronym /g" )
1332- name=$( echo " $name " | sed -E " s/[[:<:]] $capitalized [[:>:]] /$acronym /g" )
1333- name=$( echo " $name " | sed -E " s/[[:<:]] $acronym [[:>:]] /$acronym /g" )
1330+ # Use Perl for portable word boundary matching (\b works consistently across platforms)
1331+ name=$( echo " $name " | perl -pe " s/\\ b $lowercase \\ b /$acronym /g" )
1332+ name=$( echo " $name " | perl -pe " s/\\ b $capitalized \\ b /$acronym /g" )
1333+ name=$( echo " $name " | perl -pe " s/\\ b $acronym \\ b /$acronym /g" )
13341334 done
13351335 echo " $name "
13361336}
0 commit comments