REGEX - extract part of the text in a string

1

I have the following string == > "the guy with the mush he hit with the car in the car of so and so" I'm trying to extract starting from ^ ("the guy ...") and ending in ("... the car") $ Can someone help me with this RE

    
asked by anonymous 10.06.2016 / 01:53

1 answer

2

If the goal is to only select this piece you could go straight to the point:

/o cara da pamonha bateu com o carro/

Or you can use this pattern:

/o cara(.*)no carro/

See the example .

UPDATE

So if you want to stop in the first word "car" and return everything from the beginning of the sentence use this pattern:

/^(.*?)carro/

Example

    
10.06.2016 / 02:02