From: | Thomas Pundt <mlists(at)rp-online(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Regular Expression Question |
Date: | 2005-12-03 15:52:34 |
Message-ID: | 200512031652.35204.mlists@rp-online.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
Am Saturday 03 December 2005 12:48 schrieb Terry Lee Tucker:
| I have a situation where I need to extract a couple pieces of
| information from a string. The string, if entered perfectly by the user,
| would look someting like this: DUN: 006235835 SID: KT-3616*
|
| I need to extract the 006235835 into one variable and the KT-3616 into
| another. Both "numbers" can possibly be something other than numbers
| alone as in the SID: part of the string above. I have come up with a way
| of extracting both pieces of information where, at least in my mind, the
| key parameters are the colon (:) and a space, as in the first case, or
| asterik (*), as in the second case, marking the end of the string to
| extract.
given that the strings SID: and DUN: won't change, you could use the
following two RE's:
'SID: (.*?)\\*' for extracting the SID part, and 'DUN: (.*?) ' for
extracting the DUN part.
Ciao,
Thomas
----------------------------------------------------------------
Thomas Pundt <thomas(at)pundt(dot)de> -- http://www.pundt.de
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2005-12-03 16:01:15 | Re: deadlock detected - when multiple threads try to update |
Previous Message | stig erikson | 2005-12-03 14:06:07 | news.postgresql.org slow |