RE: Powershell regex

2010-01-15 Thread Michael B. Smith
That's not a regular expression! That's just System.String.Replace().

So

$strLog = ($path.Replace(/$, )).Replace(/, _) + '.log'

If you actually meant /$ as a regex, so that it removes the last character of 
$path, if it's a /, you can keep  that and do:

$strLog = ([regex]::Replace($path, /$, '')).Replace('/','_') + '.log'

So, if $path = /cygwin/c/windows/, then $strLog = _cygwin_c_windows.log.

-Original Message-
From: Joseph L. Casale [mailto:jcas...@activenetwerx.com] 
Sent: Thursday, January 14, 2010 7:11 PM
To: NT System Admin Issues
Subject: Powershell regex

Is it possible to do more than one regex in the same command?

$strLog = [regex]::Replace($path, /$, '') $strLog = [regex]::Replace($strLog, 
'/', '_') + .log + ''

That's looks hideous:)

Thanks!
jlc

~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ 
http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~



RE: Powershell regex

2010-01-15 Thread Joseph L. Casale
If you actually meant /$ as a regex, so that it removes the last character 
of $path, if it's a /, you can keep  that and do:

$strLog = ([regex]::Replace($path, /$, '')).Replace('/','_') + '.log'

So, if $path = /cygwin/c/windows/, then $strLog = _cygwin_c_windows.log.

Cool, I shouldn't have abbreviated as I have a few. For example, how can I 
actually do multiple regex's
on one line, you did a .replace but if I had to do 3 more real regex's, how do 
you join them?

([regex]::Replace($path, /$, '')) and ([regex]::Replace($path, foo, bar)) 
but I needed regex's not replacements.

Thanks so much!
jlc

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~



RE: Powershell regex

2010-01-15 Thread Joseph L. Casale
For example, how can I actually do multiple regex's on one line

Looks like -Replace handles actual regex's, that made things cleaner...

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~



Re: Powershell regex

2010-01-15 Thread Steven Peck
and randomly linking to a recently read blog post that may be of
interest to you.
http://karlprosser.com/coder/2010/01/11/replacing-many-grouped-regular-expression-matches-in-powershell/


On Fri, Jan 15, 2010 at 9:22 AM, Joseph L. Casale
jcas...@activenetwerx.com wrote:
For example, how can I actually do multiple regex's on one line

 Looks like -Replace handles actual regex's, that made things cleaner...

 ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
 ~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~



~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~



Powershell regex

2010-01-14 Thread Joseph L. Casale
Is it possible to do more than one regex in the same command?

$strLog = [regex]::Replace($path, /$, '')
$strLog = [regex]::Replace($strLog, '/', '_') + .log + ''

That's looks hideous:)

Thanks!
jlc

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~



Re: RegEX

2008-10-05 Thread Micheal Espinola Jr
Before you buy a book, check out RegexBuddy and thier support site.
you may find that you dont need a book for what you are trying to
acomplish.

On 10/3/08, Mike French [EMAIL PROTECTED] wrote:
 That's on my list - Thanks Kurt!

 -Original Message-
 From: Kurt Buff [mailto:[EMAIL PROTECTED]
 Sent: Friday, October 03, 2008 12:22 PM
 To: NT System Admin Issues
 Subject: Re: RegEX

 http://www.bookpool.com/sm/0596528124

 On Fri, Oct 3, 2008 at 8:34 AM, Mike French
 [EMAIL PROTECTED] wrote:
 Anybody use a Regex (prce) builder for windows? I've not played with
 Regex much (doing my leg work on the context) and would like to find a
 utility that would give me some debugging output and correct syntax on
 expressions. I played with a few but, I'm such a noob that I don't
 know
 if I'm looking in the right places. The feed back from a utility will
 help me learn the how, why etc. on expression building

 MIKE FRENCH
 NETWORK ENGINEER
 ~EQUITY BANK
 Office: 214.231.4565
 [EMAIL PROTECTED]
 Doing IT Right!


 ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
 ~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


 ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
 ~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~

 ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
 ~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


-- 
Sent from Gmail for mobile | mobile.google.com

ME2

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


RegEX

2008-10-03 Thread Mike French
Anybody use a Regex (prce) builder for windows? I've not played with
Regex much (doing my leg work on the context) and would like to find a
utility that would give me some debugging output and correct syntax on
expressions. I played with a few but, I'm such a noob that I don't know
if I'm looking in the right places. The feed back from a utility will
help me learn the how, why etc. on expression building 

MIKE FRENCH
NETWORK ENGINEER
~EQUITY BANK
Office: 214.231.4565
[EMAIL PROTECTED]
Doing IT Right!


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


RE: RegEX

2008-10-03 Thread Andy Ognenoff
I've been using RegExBuddy to learn and to maintain a library of useful
expressions. It comes with a standard set of expressions that are pretty
useful too. It's got a really nice explain function that tells you what
each part of the expression you're building does.

http://www.regexbuddy.com/

 - Andy O.

-Original Message-
From: Mike French [mailto:[EMAIL PROTECTED]
Sent: Friday, October 03, 2008 10:35 AM
To: NT System Admin Issues
Subject: RegEX

Anybody use a Regex (prce) builder for windows? I've not played with
Regex much (doing my leg work on the context) and would like to find a
utility that would give me some debugging output and correct syntax on
expressions. I played with a few but, I'm such a noob that I don't know
if I'm looking in the right places. The feed back from a utility will
help me learn the how, why etc. on expression building

MIKE FRENCH
NETWORK ENGINEER
~EQUITY BANK
Office: 214.231.4565
[EMAIL PROTECTED]
Doing IT Right!


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


RE: RegEX

2008-10-03 Thread Mike French
Thanks Andy,
 Looks like the road to Regex will be a little easier; I'm still doing
some digging. Looks like a lot to learn but, once I get my brain wrapped
around this, it might not be too bad.

-Original Message-
From: Andy Ognenoff [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 03, 2008 11:23 AM
To: NT System Admin Issues
Subject: RE: RegEX

I've been using RegExBuddy to learn and to maintain a library of useful
expressions. It comes with a standard set of expressions that are pretty
useful too. It's got a really nice explain function that tells you
what
each part of the expression you're building does.

http://www.regexbuddy.com/

 - Andy O.

-Original Message-
From: Mike French [mailto:[EMAIL PROTECTED]
Sent: Friday, October 03, 2008 10:35 AM
To: NT System Admin Issues
Subject: RegEX

Anybody use a Regex (prce) builder for windows? I've not played with
Regex much (doing my leg work on the context) and would like to find a
utility that would give me some debugging output and correct syntax on
expressions. I played with a few but, I'm such a noob that I don't know
if I'm looking in the right places. The feed back from a utility will
help me learn the how, why etc. on expression building

MIKE FRENCH
NETWORK ENGINEER
~EQUITY BANK
Office: 214.231.4565
[EMAIL PROTECTED]
Doing IT Right!


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


Re: RegEX

2008-10-03 Thread Steven Peck
I am a fan of Regex Buddy.
http://www.regexbuddy.com/

I used it when we had to build expressions for some telephony
integration with LCS and a co-worker loved it for building expressions
for testing incoming/outgoing email for PHI information to match HIPAA
requirements.

Steven

On Fri, Oct 3, 2008 at 8:34 AM, Mike French
[EMAIL PROTECTED] wrote:
 Anybody use a Regex (prce) builder for windows? I've not played with
 Regex much (doing my leg work on the context) and would like to find a
 utility that would give me some debugging output and correct syntax on
 expressions. I played with a few but, I'm such a noob that I don't know
 if I'm looking in the right places. The feed back from a utility will
 help me learn the how, why etc. on expression building

 MIKE FRENCH
 NETWORK ENGINEER
 ~EQUITY BANK
 Office: 214.231.4565
 [EMAIL PROTECTED]
 Doing IT Right!


 ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
 ~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


Re: RegEX

2008-10-03 Thread Kurt Buff
http://www.bookpool.com/sm/0596528124

On Fri, Oct 3, 2008 at 8:34 AM, Mike French
[EMAIL PROTECTED] wrote:
 Anybody use a Regex (prce) builder for windows? I've not played with
 Regex much (doing my leg work on the context) and would like to find a
 utility that would give me some debugging output and correct syntax on
 expressions. I played with a few but, I'm such a noob that I don't know
 if I'm looking in the right places. The feed back from a utility will
 help me learn the how, why etc. on expression building

 MIKE FRENCH
 NETWORK ENGINEER
 ~EQUITY BANK
 Office: 214.231.4565
 [EMAIL PROTECTED]
 Doing IT Right!


 ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
 ~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


RE: RegEX

2008-10-03 Thread Mike French
That's on my list - Thanks Kurt!

-Original Message-
From: Kurt Buff [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 03, 2008 12:22 PM
To: NT System Admin Issues
Subject: Re: RegEX

http://www.bookpool.com/sm/0596528124

On Fri, Oct 3, 2008 at 8:34 AM, Mike French
[EMAIL PROTECTED] wrote:
 Anybody use a Regex (prce) builder for windows? I've not played with
 Regex much (doing my leg work on the context) and would like to find a
 utility that would give me some debugging output and correct syntax on
 expressions. I played with a few but, I'm such a noob that I don't
know
 if I'm looking in the right places. The feed back from a utility will
 help me learn the how, why etc. on expression building

 MIKE FRENCH
 NETWORK ENGINEER
 ~EQUITY BANK
 Office: 214.231.4565
 [EMAIL PROTECTED]
 Doing IT Right!


 ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
 ~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~