Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5841215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:51:40+00:00 2026-05-22T11:51:40+00:00

How to validate zipcode using regular expression? It should be in the following pattern:-

  • 0

How to validate zipcode using regular expression?

It should be in the following pattern:-

[A-z][0-9][A-Z] [0-9][A-Z][0-9]

E.g.

B5D 2M4 
b5d 2m4 

I am using Oracle9i.

Thanks in advance,
Shubhojwal Ghosh

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:51:40+00:00Added an answer on May 22, 2026 at 11:51 am

    Unfortunately, since you are using a very old version of Oracle, you cannot use the standard regular expression functions like REGEXP_LIKE. If you were to upgrade to a moderately recent version of Oracle, that would be the way to go.

    In older versions of Oracle, you would have to use the OWA_PATTERN package. Note that since the OWA_PATTERN.MATCH function returns a BOOLEAN, you cannot call it from SQL, just from PL/SQL. You could, of course, create your own wrapper function that returns an integer or a string to indicate whether the ZIP code is valid.

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    function is_valid_zip( p_zip_code in varchar2 )
      3      return boolean
      4    is
      5    begin
      6      return owa_pattern.match( p_zip_code,
      7                                '[A-Z]{1}\d{1}[A-Z]{1}\d{1}[A-Z]{1}\d{1}',
      8                                'i' );
      9    end is_valid_zip;
     10  begin
     11    if( is_valid_zip( 'A1B2C3' ) )
     12    then
     13      p.l( '1) Match' );
     14    else
     15      p.l( '1) No match' );
     16    end if;
     17    if( is_valid_zip( '12345' ) )
     18    then
     19      p.l( '2) Match' );
     20    else
     21      p.l( '2) No match' );
     22    end if;
     23* end;
    SQL> /
    1) Match
    2) No match
    
    PL/SQL procedure successfully completed.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to validate an xml file against its associated schema using Visual
I'm using jQuery validate on a form I am building and it is working
I'm looking to implement a zipcode field in django using the form objects from
I am using jQuery to validate all of the fields on my Sign up
Problem I want to validate a field using a custom validator I've created that's
I am assuming I need a regular expression here? I have a zip code
How can I validate a zipcode field in my form depending on the country
<input type=text id=zipCode /> how can i validate that this is a valid zip
I am trying to validate a date in the format dd/mm/yyyy using a function
I need to validate the email address that are semicolon separated using ListView. e.g.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.