Java Check If String Contains Any Substring From End Javascript