Regular expression to extract text between two sets of characters (Javascript)

Posted by optician on Stack Overflow See other posts from Stack Overflow or by optician
Published on 2010-04-22T15:11:13Z Indexed on 2010/04/22 15:13 UTC
Read the original article Hit count: 221

Filed under:
|

I would like to extract some text between two points in a string, in Javascript

Say the string is

"start-extractThis-234"

The numbers at the end can be any number, but the hyphens are always present.

Ideally I think capturing between the two hypens should be ok.

I would like the result of the regex to be

extractThis

© Stack Overflow or respective owner

Related posts about regex

Related posts about JavaScript