1

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

Alan Moore
  • 73,866
  • 12
  • 100
  • 156
wiki
  • 1,877
  • 2
  • 31
  • 47

1 Answers1

1

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)

`

Rajeshwar
  • 2,290
  • 4
  • 31
  • 41