I have a string that looks like this: “the word you need is ‘hello’ “.
What’s the best way to put ‘hello’ (but without the quotes) into a javascript variable? I imagine that the way to do this is with regex (which I know very little about) ?
Any help appreciated!
Use
match():This will match a starting
', followed by anything except', and then the closing', storing everything in between in the first captured group.