Amer A
Amer A

Reputation: 11

Regex Delete Everything Up To The First Period

So this is something that has been playing on my mind for a while. I am a newbie to Regex. I know the basics but can't figure out how to put this regex together. Say I have the following

example1.keep.co.uk
example2.example3.keep.co.uk
example1.keep.me.uk
example2.example3.keep.me.uk
example1.keep.org.uk
example2.example3.keep.org.uk

In all the above examples I want to keep only keep.co.uk,keep.me.uk,keep.org.uk. Everything else should be stripped. I know I need to use .co.uk$|.me.uk$|.org.uk$. I want to say keep these but delete everything else to the left of the period. Any suggestions?

Upvotes: 0

Views: 223

Answers (1)

vks
vks

Reputation: 67978

.*?(keep.*$)

Try this.

See demo.

http://regex101.com/r/sA7pZ0/22

Upvotes: 1

Related Questions