dududiop
dududiop

Reputation: 13

Regex find string between string

I want to find a string in 3 types of inputs :

  1. Client XXX.MYDOMAIN.COM is
  2. Client YYY is
  3. Client ZZZ.mydomain.com is

What I want is :

  1. XXX
  2. YYY
  3. ZZZ

Can someone help me with this. Thank you.

Upvotes: 1

Views: 63

Answers (2)

donfuxx
donfuxx

Reputation: 11321

Try this regex:

(?<=Client\s)\b\w+\b

see demo here: http://regex101.com/r/lQ9hD0

Upvotes: 1

Lajos Veres
Lajos Veres

Reputation: 13725

This matches to the 3 example strings after Client:

Client (XXX|YYY|ZZZ)

Or if you would like to match anything 3 character:

Client (...)

Upvotes: 1

Related Questions