DreadAngel DreadAngel - 1 year ago 62
Java Question

RegEx - finding group at the end of the line

Expression does not match if it is located at the end of the line:


test string:


as result:


but the last one is missed (tested via)

What I'm missing?

Answer Source

Assuming that you would like to have a result like:


Then, just try the follow regex:



The final "\b" on the regex you have provided, forces that the character "%%" can't be the last element on the target string.

Hope this helps you.

Cheers, Nikolas.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download