How can I sort a-z ignoring spaces and hyphens, please?

Items in a book index of 6000 items

aa b,  
aa c,
aa-b,  
aa-c,
aaab,  
aab,
aac,

so sorted, must appear instead as

aaab, 
aa b,  
aa-b,  
aab,
aa c,
aa-c,
aac

I can’t see anything in the options for enabling this type of sorting. Presumably you are looking to duplicate the difference between Letter by letter and Word by word sorting as supported by Adobe InDesign (shown here). The ICU collation engine used by LO does appear to support the ability to ignore punctuation, which would seem to be similar, however the lack of options may mean this functionality is not exposed to the user.

Bug 70782 - Other: enhancement request

Add a temporary column for additional calculations.

Enter the formula

=SUBSTITUTE(SUBSTITUTE(<first source cell>;" ";"");"-";"")

Multiply the formula to all cells of the sorted column.

Sort the entire region from the values ​​of the auxiliary column.

Delete the temporary column

Sort Without Spaces

Thank you, Oweng and JohnSUN, respectively for the background and the workaround. “Bug 70782 - Other: enhancement request” asks for this kind of sorting.