I have a string like :
<RandomText>
executeRule(x, y, z)
<MoreRandomText>
What I would like to accomplish is the following: if this executeRule string exists in the bigger text block, I would like to get its 2’nd parameter.
How could I do this ?
What do you mean the bigger text block?
If you want to extract the second param from that expression, it would be something like
The second param is held on capture group $1.
Keep in mind that to use this expression in Java, you need to escape the ‘\’. Also, I’m just assuming \w is good enough to match your params, that would depend on your particular rules.
If you need some help with actually using regexes in Java, there are many resources you can turn to, I found this tutorial to be fairly simple and it explains the basic usages:
http://www.vogella.de/articles/JavaRegularExpressions/article.html