Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2009
    Posts
    6

    Post Unanswered: postgres- Pattern Matching-Regular Expression query needed

    I have cloumn(registerNo) of length 10 Values are

    12KA01SA12
    13KA03MA10
    15PA01GF20
    12TV01SV14

    I need a Regular Expression to search with first 2 position(that is 12),5th and6th position(that is 01) from the column registerNo????

    advance thankz...
    Last edited by fernandodonster; 08-12-15 at 02:34.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    I don't see why you would need RegEx for that:

    Code:
    select *
    from the_table
    where left(registerno,2) = '12'
      and substring(registerno, 5, 2) = '01'
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •