Howto Find and Replace with RegEx
by pizzipie from LinuxQuestions.org on (#56ZQQ)
Hi,
Using Ubuntu 18.04.
Typically in Bluefish Editor, LibreOffice, or Pluma:
I am trying to replace a 10 digit number with a Telephone-Number-like format. (I have a LibreOffice Calc Sheet with about 400 phone no's in 10 digit format)
2025551212 => 201.555.1212
I find the raw number 2025551212 with \d{3}\d{3}\d{4}
Find: \d{3}\d{3}\d{4} or I've tried (\d{3})(\d{3})(\d{4}) or /(\d{3})(\d{3})(\d{4})/
Replace With: ???????????????????????????
to get (\d{3}).(\d{3}).(\d{4})
201 . 555 . 1212
I had an answer to a question similar to this from a LibreOffice Forum and part of the answer I got was:
Quote:
Which I have not been able to make work.
Thanks for any help,
R


Using Ubuntu 18.04.
Typically in Bluefish Editor, LibreOffice, or Pluma:
I am trying to replace a 10 digit number with a Telephone-Number-like format. (I have a LibreOffice Calc Sheet with about 400 phone no's in 10 digit format)
2025551212 => 201.555.1212
I find the raw number 2025551212 with \d{3}\d{3}\d{4}
Find: \d{3}\d{3}\d{4} or I've tried (\d{3})(\d{3})(\d{4}) or /(\d{3})(\d{3})(\d{4})/
Replace With: ???????????????????????????
to get (\d{3}).(\d{3}).(\d{4})
201 . 555 . 1212
I had an answer to a question similar to this from a LibreOffice Forum and part of the answer I got was:
Quote:
Also you can use Find&Replace whith this options Find: ([^;]*);(.*) //Robert;Smith Replace: $2;$1 //Smith;Robert Regular expresions: ON |
Thanks for any help,
R