Sam Sam - 1 year ago 91
Java Question

How to check if String has a Letter after a specific letter?


String letter = "abc+ab.c+abc.ab";

How to check if String letter contains
after last

Answer Source

About your modified question: to match . any time after + char try this:


Note: you it was necessary to escape + and . with \\ to match dot and plus literally, since those have a special meaning in regex.

Update: If you only want to match only if there is a dot after last + you could do this:


where the [^+] part means any char except +.

BTW: I would name your String letter instead of Letter because of naming conventions

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