Regex matching into multiple groups per line?

Posted by dmose on Stack Overflow See other posts from Stack Overflow or by dmose
Published on 2010-03-08T01:03:45Z Indexed on 2010/03/08 1:18 UTC
Read the original article Hit count: 377

Filed under:
|

I'm trying to come up with a regex to be able to parse the following type of strings into groups.

<link rel="alternate" type="application/rss+xml" title="[!PageTitle!]" href="[!SiteRoot!]/feed.xml" />

My regular expression is:

\[\!(.+)\!\]

The problem with this expression is that it seems to pull it all into 1 group:

Found 1 match:

  1. "[!PageTitle!]" href="[!SiteRoot!]" has 1 group:

     1. "PageTitle!]" href="[!SiteRoot"
    

I want dont want the regex to continue...am I missing a boundary? Ideally I want it to find 2 groups,

[!PageTitle!]

and

[!SiteRoot!]

© Stack Overflow or respective owner

Related posts about regex

Related posts about c#