Use Regex to find some match words in a line beginning with specific string

I have input like following example:

Contact to Hwang Contact to John, Peter in Newyork, Shara

Using Regex, how to get "Hwang", "John" "Peter, "Shara" for the result. The line always begin with "Contact to". The first value after "Contact to", other values seperated by commas without including location.

Any idea to solve my problem! Thank.

--------------Solutions-------------

The first value after "Contact to", other values seperated by commas without including location.

Try this:

/Contact to |(\w+?\b)[^,\n\r]*/gi

Use Regex to find some match words in a line beginning with specific string

Demo: https://regex101.com/r/iG1aT3/3

Category:javascript Time:2018-07-28 Views:0

Related post

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.317 (s). 13 q(s)