You are here: PSPad forum > English discussion forum > Re: How do you find an even and odd number?

Re: How do you find an even and odd number?

#1 Regular Expression to match only odd or even number

Posted by: maki | Date: 2020-05-19 08:35 | IP: IP Logged

How do you find an even and odd number?
Regular Expression to match only odd or even number???
Invalid Regex: \d*[13579]
2.52 Wrong
2.57 Correct

1.75
2.25
2.33
2.38
2.38
2.38
2.42
2.47
2.52
2.52
2.52
2.57
2.62
2.62
2.62
2.68
2.68
2.73
2.73
2.79
2.79
2.79
2.79
2.85
2.85
2.85
2.85
2.85
2.85
2.85
2.85
2.85
2.97

Edited 3 time(s). Last edit at 2020-05-19 08:40 by maki.

Options: Reply | Quote | Up ^


#2 Re: How do you find an even and odd number?

Posted by: pspad | Date: 2020-05-19 08:39 | IP: IP Logged

Use regular expression. Last number must be even or odd.
^\d+\.\d+[02468]$

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2020 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR