kadourah
kadourah

Reputation: 101

Regex expression statement pattern

I'm trying to extract values from the following statement using Regex , the statement looks like this: from JFK to IND So, I need to be able to extract JFK and IND

Can you help in providing the right regex expression for it?

Upvotes: 0

Views: 68

Answers (2)

Brad
Brad

Reputation: 15577

from\s+(?<origin>[A-Z]{3})\s+to\s+(?<destination>[A-Z]{3})

Upvotes: 2

rtpHarry
rtpHarry

Reputation: 13125

^from ([A-Z]{3}) to ([A-Z]{3})$

the values you want will be in the two capture groups.

I can't elaborate any more unless you specify what language you are using the regex's in?

Upvotes: 0

Related Questions