开发者

Regex expression statement pattern

开发者 https://www.devze.com 2023-01-28 09:18 出处:网络
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

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 providi开发者_开发百科ng the right regex expression for it?


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


^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?

0

精彩评论

暂无评论...
验证码 换一张
取 消