Let’s say I have a string like this
Hello World, I am xyz, How are you ?
And I need all the characters in the string that comes after last comma. Which is here
How are you?
How can I do this ?
Note : Here space in the beginning should not come.
Also I need the remaining string into another variable which will be
Hello World, I am xyz
Note: here comma in the end should not come.
You can do that with a simple regex:
Or, if you want to take care of the leading space at the same time:
If you want the first part and the “How are you ?” part, then you could use
matchinstead ofreplace: