N
N
nch2021-11-24 18:34:19
excel
nch, 2021-11-24 18:34:19

How to extract the last (or only) line using a regular expression?

I have a table in Excel with a bunch of addresses like this:

Via Strada di Pontenuovo, 42
Santa Marinella (Rome)
Santa Marinella, Rome 00058
Italy


WA 98663
United States


Sri Lanka


From these addresses, I need to isolate the countries and put them in the next column. The country is always on the last line.

How to extract the last (or only) line using a regular expression?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Akina, 2021-11-24
@nch

([^\n]+)\n?$
https://regex101.com/r/a2dYbs/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question