I think this is fairly simple. I'd like to only return the string values that contact leading numbers in my query results.
For example:
003 - Preliminary Examination Plan
005 - Coordination
1000a - Balance sheet
Advertising
Amortization
Partnerships
Would like to get:
003 - Preliminary Examination Plan
005 - Coordination
1000a - Balance sheet
This code gave me zero results. How do I check if the leading numbers contain digits and return the rest of string?
select distinct AIssue
from SQLIssue
where regexp_like( AIssue, '^[[:digit:]]*$' )
order by AIssue
Your current regex reqiures the string to consist entirely of digits. Try the following:
where regexp_like( AIssue, '^[[:digit:]].*$' )
(note the added dot).
To elaborate, .
matches any character, and *
means "repeat the previous term zero or more times".
Thus, the original regex says "zero or more digits", whereas the above regex says "a digit followed by zero or more of any characters.
edit: A shorter version of the above regex has been suggested by @mellamokb in the comments:
where regexp_like( AIssue, '^[[:digit:]]' )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With