I have hyphen separated words in paragraphs that I'm trying to extract.
I've tried following regex w+-w
, however this is not working as expected.
Here's the complete code written in JavaScript.
var string = "time to eval-u-ate";
var result = string.match(/w+-w/g); // ["eval-u"]
This returns the string eval-u
. I want the result to be eval-u-ate
. How can I modify the regex to match complete hyphenated words.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…