Sam Sam - 7 months ago 28
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


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