Reputation: 7176
I have been monkeying with the following regex expression:
(\b\*)\w+(\*\b)
What I wanted to do was extract
^vitae^
from
Nam vestibulum hendrerit justo. Quisque ^vitae^ libero magna. Curabitur pretium eros ut augue ullamcorper feugiat. Aenean blandit libero vitae nunc sodales pharetra.
But what I seem to get is that regex found the text in question and returns the all of the text in the sentence as opposed to just
^vitae^
Any help would be greatly appreciated
Thanks!
Upvotes: 0
Views: 859
Reputation: 14453
To match any text between ^
@"\^([^^]*)\^")
//matchs ^ anything that isn't ^ and finally ^
It also matches line breaks if there are any
Upvotes: 2