I wanna learn more of regex But the complexity of the patterns makes my learning difficult.
I need to find all trailing zeros in a string. Can someone show me a pattern then explain how it works.
I wanna learn more of regex But the complexity of the patterns makes my learning difficult.
I need to find all trailing zeros in a string. Can someone show me a pattern then explain how it works.
Try /[0]+$/g
For example
"2342300".match(/[0]+$/); //["00"]
Explanation
[0]+
matches continous 0
s$
at the end matches end of the input and ensures only 0
s at the end of the string is matched.