I have the problem to define the regexpression (for a Java program), that gives me the last matching group of something. The reason for that is the conversion of some text files (here: the export of some wiki) to the new format of the new wiki.
For example, when I have the following text:
Here another include: [[Include(a/a-1)]] The hierarchy of the pages is:
/a /a-1 The old wiki referenced the hierarchy name, the new wiki will only have the title of the page. The new format should look like:
{include:a-1} Currently I have the following regular expression:
/\[\[Include\(([^\)]+)\)\]\]/ which matches from the example above a/a-1, but I need a regular expression that matches only a-1.
Is it possible to construct a regular expression for java that matches the last group only?
So for the following original lines:
[[Include(a)]] [[Include(a/b)]] [[Include(a/a-1)]] [[Include(a/a-1/a-2)]] I would like to match only
a b a-1 a-2