Regex to select specific section

8

I need to identify the name, CPF and address information within contracts.

The landlord's line is as follows:

  

LANDLORD: Jose Reinaldo Lellis de Andrade

     

LOCATOR: Isabel Cristina de Rezende Leme Ferreira Andrade

I can select the entire line with the code (locador[a]?):.*\n , but this expression returns me the word Lessor too.

How do I return only the name after the word LOCADOR/LOCADORA: ?

    
asked by anonymous 20.05.2014 / 00:28

3 answers

3

As stated in the other answer you should specify what technology you are using.

The regex below is working on a test I performed:

/locador..(.*)/gi 

Demo

    
20.05.2014 / 00:38
2
(locador[a]?):(.*)\n

I do not know what technology you are using, but basically you would have to get the name of the second group (second set in parentheses) and delete the \n from the end.

    
20.05.2014 / 00:33
0

The answer from stderr is correct but only to clarify the error of your RegEx It was the use of parentheses they separate the match group, ie what you want to capture

locador[a]?:(.*)

link

    
24.01.2017 / 14:17