Reputation: 2043
I have a very long list of words that after converting from another format, some of the words in it are hyphenated. for example:
book, im-moral, law
intesti-nal, lung
flimflam*, fly-by-night*, illegal,
How can I capture all the phrases that have hyphen in them? In case of above example it would be:
im-moral
intesti-nal
fly-by-night
RegEx flavor: regular expressions engine implemented in EditPad Pro 7
Upvotes: 1
Views: 39
Reputation: 2509
Please take a look at this plunker link. As anubhava mentioned, we can use the same regexp. I have also added a simple example to check it.
`
var str = 'book, im-moral,law,intesti-nal,lung, flimflam*, fly-by-night*, illegal';
var re = /([a-zA-Z]+(-[a-zA-Z]+)+)/gi;
var found = str.match(re);
alert(found)
`
Upvotes: 1