You're right. I think, I couldn't tell you what I exactly need. When I try to compile the regular expression over there in Perl, the result is perfect. But if I compile it in Java, it doesn't work. Do you have any suggestion for me?
You don't even tell us what problem you have with your Java code.
This is not a code writing service, neither for Perl nor for Java. We will maybe help you with formulating the regular expression in a way that Java understands the Perl regular expression. But we don't know Java here, in general, so you will have to learn both if you want to translate from one to the other.
The perl side is straightforward, just use perlre to decipher all the parts of the regex. First look up the flags "gxm" at the end that change some details of how the regex works.