3

What is a regEx to find a zero at the end of a string?

For instance, I want it to find the 0 in 32.20, but not the 0 in 302.2

Thank you!

3 Answers 3

5

If you want to match the zero in 30.1, it’s 0(?=\.|$). Else, it’s just 0$

Sign up to request clarification or add additional context in comments.

Comments

1

UPDATED:

The right one would be:

0$

Comments

1

/0$/ or /.*0$/ if you need the whole string that ends with a zero. Here a working example on Rubular.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.