Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

regular expression: integer in range 0..100

WestDraytonApr 17 2010 — edited Apr 17 2010
What is the best regular expression to satisfy need:
1) input string must be integer, minimal value is 0, maximal value is 100, no other symbols are allowed in string, no commas no spaces.

Example data:
with T as 
(select '-1' str from dual --not ok
union
select '0' str from dual --ok
union
select '1' str from dual --ok
union
select '100' str from dua --ok
union
select '1000' str from dual-- --not ok
union
select '101' str from dual --not ok
union
select '10.1' str from dual --not ok
union
select '10,1' str from dual --not ok
union
select 'a' str from dual --not ok)
select * from T
where regexp_like(str,'^[[:digit:]]{0,3}$');
This post has been answered by Frank Kulash on Apr 17 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 15 2010
Added on Apr 17 2010
23 comments
3,325 views