Re: Regulat expression question
- From: "Kevin Spencer" <unclechutney@xxxxxxxxxxxx>
- Date: Thu, 3 May 2007 08:08:41 -0400
(?<=User\s+ID\s*=\s*)[^;]+
It's not necessary to test for any previous text. Also, this version
accounts for possible line breaks in the Connection String.
--
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
"Jesse Houwing" <jesse.houwing@xxxxxxxxxxxxxxxx> wrote in message
news:%23RZlp3PjHHA.4624@xxxxxxxxxxxxxxxxxxxxxxx
* Göran Andersson wrote, On 2-5-2007 15:20:
mamin@xxxxx wrote:
Hi, I have the following string:
"Data source=(local);Initial catalog=GeomelioDaneEwidencyjne;User
ID=aaa;Password=bbbbb;"
I need to get values of User ID from it. (aaa),
how can I do it using regular expressions?
Adding the special case that the user id may be the last parameter, not
followed by a semicolon (which is not appearent from your example), this
pattern would work:
"(?:^|;)User ID=([^;]+)(?:;|$)"
(?<=(?:;|^)\s*User ID\s*=\s*)[^;]+
Should result in only the text following User ID as match. Which is
probably easier to use.
Jesse
.
- Follow-Ups:
- Re: Regulat expression question
- From: Jesse Houwing
- Re: Regulat expression question
- From: Göran Andersson
- Re: Regulat expression question
- References:
- Regulat expression question
- From: mamin
- Re: Regulat expression question
- From: Göran Andersson
- Re: Regulat expression question
- From: Jesse Houwing
- Regulat expression question
- Prev by Date: Re: Try this
- Next by Date: Re: application won't start if needed assembly is missing...
- Previous by thread: Re: Regulat expression question
- Next by thread: Re: Regulat expression question
- Index(es):
Relevant Pages
|