"Find and replace" with regular expressions in MS Word 2016

Asked

Viewed 2,636 times

4

I have a list with the result of candidates for an open competition I want to sort by note. However, before making the ranking need to remove the registration number of each competitor, which follows the following format, for all:

380.01227119/3

How can I use a regular expression in the "Find and Replace" function of MS Word 2016 to remove all registration numbers?

Edit 1 - Sample the contents of the file

380.01229569/6; ADAILDSON DE OLIVEIRA MAIA FREITAS; 18,50; 4,50; 38,00; 61,00 / 380.01245362/3; ADAILSON GASPAR DE JESUS; 8,50;  12,50;  24,00;  45,00  /  380.01238440/2;  ADAILTON  SILVA  OLIVEIRA;  20,50;  6,50;  40,50;  67,50 /  380.01232099/7;  ADEILSON  DA SILVA  MARTINS;  4,00;  6,50;  27,00;  37,50  /  380.01240923/7;  ADONIAS  REBOUÇAS  DOS  SANTOS;  19,00;  11,00;  37,50;  67,50
  • Could you put the format of the information? I can’t access the pdf link.

  • Okay, @rray, I added one sample.

  • Select the information then click on the button { } to format them. You can leave only 5 or 6 example lines. I tried to format but it got weird.

  • You just want to remove the registration numbers? Don’t want to store anywhere? Microsoft Excel would no longer be indicated to format your Infos?

  • @Paz, I just want to remove the registration numbers even, then I’ll pass to Excel.

  • @rray I did as you asked, leaving only 5 lines of the list. PDF.

Show 1 more comment

3 answers

4


You can use the following expression in Word: ([0-9]{3}.[0-9]{8}\/[0-9]{1};)

Where:

  • [0-9]{3}.: selects 3 numbers before the point + the point.
  • [0-9]{8}\/: selects 8 numbers before the bar + the bar.
  • [0-9]{1};: selects 1 number before the semicolon + the semicolon.

The expression should be in parentheses so that the Word interprets the expression.

From what I saw \d is not interpreted by Word, so should be replaced by [0-9]

Has a example functional in the documentation.


Remember to check the option: Usar caracteres curinga when applying the filter.

inserir a descrição da imagem aqui

2

You can use the following regex ^\d+\.\d+/\d; it says to always capture at the beginning one or more digits (^\d+) followed by a point (.) followed by one or more digits (\d+) followed by a bar / and exactly another digit.

In the test I ran I used the following formatting for the information:

380.01229569/6; ADAILDSON DE OLIVEIRA MAIA FREITAS; 18,50; 4,50; 38,00; 61,00 /
380.01245362/3; ADAILSON GASPAR DE JESUS; 8,50;  12,50;  24,00;  45,00  /
380.01238440/2;  ADAILTON  SILVA  OLIVEIRA;  20,50;  6,50;  40,50;  67,50 /
380.01232099/7;  ADEILSON  DA SILVA  MARTINS;  4,00;  6,50;  27,00;  37,50  /

0

^[^A-Z]+

I don’t use windows, much less word, but this regex means: At the beginning of the line ( ) go over everything up to a capital letter [ A-Z]. It should work in word, because it definitely works in Libreoffice

Browser other questions tagged

You are not signed in. Login or sign up in order to post.