Reputation: 110960
Given:
How do I go about getting what's in between the -
and the +
, in this case being reply
?
I'm trying:
[/\-(.*?)+/,1]
Upvotes: 1
Views: 517
Reputation: 138874
The following is a general regex syntax for a pattern that should work:
^([^-]*)-([^+]*)\+.*$
Rubular says it works. Look at the match captures.
Explanation:
^ // the start of the input
([^-]*) // the 'thread' part
- // a literal '-'
([^+]*) // the 'reply' part
\+ // a literal '+'
.* // the rest of the input
$ // the end
Upvotes: 2