Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2005
    Posts
    13

    Unanswered: regular expression

    How do I do regular expression for the problem that I am having
    I have a string called desc, and say that this string in

    "TSWUU" --should be ""
    "4 - DSC" -----should be "4"
    "6768 - THY" ------should be "6768"

    basically string may or may not start with number,
    I need substring of digits parts
    ""
    "4"
    "6768"

  2. #2
    Join Date
    Oct 2005
    Posts
    1
    Quote Originally Posted by gozfidan
    How do I do regular expression for the problem that I am "TSWUU" --should be ""
    "4 - DSC" -----should be "4"
    "6768 - THY" ------should be "6768"
    Do you mean that you want a regular expression wich matches nothing in the string "TSWUU", which matches 4 in the string "4 - DSC" and which matches 6768 in the string "6768"?

    I guess you are just looking for any number?
    Then you can try this:

    [0-9]*

    (I don't know the syntax of PostgreSQL regexp's yet, but if they follow the standards it must be that one)

    If you want the number to be seperated from other characters, you can use this:

    <[0-9]*>
    or
    \<[0-9]*\>

    (I don't know whether the <, > characters need to be escaped or not...)

Posting Permissions

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