RegEx to get text after word and new line


I’m trying to become better at Regex. Can someone please help me get “Company ABC” in this string:

Company Name: Company ABC
Address: Fake Address

Use regex (?<=Company Name: ).*.

To get better with regexes, visit and test your regular expressions at


Hey thanks for this.

I understand everything until the .* What does the .* do?

The . means “any character”, whether it be a space, numbers, letters, etc. The * means “0 or more of the previous indicator”. So in all it means “0 or more of any character”.

ah so after Company name, get any character?

Yes, and this works on a single-line basis. So if your string contains newline characters, it stops before going to the next line.

Great! So what if I wanted a newline as well? Say I wanted “Company ABC DEF Corp” from:

Company Name: Company ABC
DEF Corp


Then append \n.* if you want all lines after that in one match.


Ah great! But what if I just want the next line and not all the lines?

Append \n[^\n]* instead.

1 Like

Watch this video:

I found it to be a great tutorial.