I usually run into situations at work where I need to clean a CSV file having phone numbers. Doing a quick Google search does not help because most people out there want the exact opposite.
Let me give you an example.
What most people want:
Input:
1234567890
Output:
123-456-7890 (or) (123) 456 780 (or) 123 456 7890
What I people want:
Input:
123-456-7890 (or) (123) 456 780 (or) 123 456 7890 (or) 123*456*789
Output:
1234567890
Doing a slow and careful Google search led me to this beautiful piece of code. Just select the region which you want cleaned and run the following macro. It will save you a lot of time. Also feel free to modify it to your needs.
Sub replace
oCurrentSelection = ThisComponent.CurrentSelection
xReplaceDesc = oCurrentSelection.createReplaceDescriptor()
xReplaceDesc.SearchRegularExpression = TRUE
xReplaceDesc.SearchString = "[- *.]"
xReplaceDesc.ReplaceString = ""
oCurrentSelection.replaceAll( xReplaceDesc )
End Sub
Have fun!