Regex to find the last word in the string
Posted: Wed Jun 07, 2017 6:29 am
Hello All,
As this is my first post and I am posting a REGEX question.
I am using a REGEX to get the last word from the string and it is working fine only if it does not have a special characters.
test02 cIuTpSUmJOeKyp6Pvc0w
Regex:\s(\w+)$
Working fine - cIuTpSUmJOeKyp6Pvc0w
It is not working if it has special characters like $,#,-,@,).
test02 cIuTpSUm#JOeKyp6Pvc0w
Regex:\s(\w+)$
Not Working -
Can someone provide the regex for fetching the last word from the string?
Looking forward for the response from the experts.
Regards
MIAJ
As this is my first post and I am posting a REGEX question.
I am using a REGEX to get the last word from the string and it is working fine only if it does not have a special characters.
test02 cIuTpSUmJOeKyp6Pvc0w
Regex:\s(\w+)$
Working fine - cIuTpSUmJOeKyp6Pvc0w
It is not working if it has special characters like $,#,-,@,).
test02 cIuTpSUm#JOeKyp6Pvc0w
Regex:\s(\w+)$
Not Working -
Can someone provide the regex for fetching the last word from the string?
Looking forward for the response from the experts.
Regards
MIAJ