S
Smarta55 Chris
Can someone help me find the last n folders in a path,
or the last n OUs in a fully qualified Netware name... for an app object,
etc?
Example:
\\server\volume\share\folder\folder\folder
I want to grab just the last 2 folders (including or excluding the \s), but
sometimes there
are 3 folders after the share, like in the example, and sometimes there are
more.
Same for an app object in eDirectory
..appobject.dept.biz.site.county.state.tree
How to I grab just the .site.county.state.tree OUs?
Sometimes there are 5 OUs after the app object, and sometimes more.
I want, I think, to "start at the end of the string, and grab everything
after the 4th dot from the end," but don't have a clue how to code this.
I'm not a perl newbie, but I'm no expert....and I AM a RegEx idiot!
Here's some of what I've tried:
$string = ".appobject.dept.biz.site.county.state.tree";
$string =~ /\..+\..+\..+/$; # i.e. match a literal dot followed my
anything mult times, followed by another literal dot, followed, etc...
# starting at the end of the string
$string =~ /(\.\W)*/; # \w does NOT match AlphaNum like it's supposed to,
\W DOES, but it's NOT supposed to.
# unless . is an AlphaNum character, but I'm
not sure
And I can't remember the 4,612 other patterns I've tried, or the
accompanying 4,612 hairs I've
yanked from my scalp in the process. :-(
Thank you,
Chris
or the last n OUs in a fully qualified Netware name... for an app object,
etc?
Example:
\\server\volume\share\folder\folder\folder
I want to grab just the last 2 folders (including or excluding the \s), but
sometimes there
are 3 folders after the share, like in the example, and sometimes there are
more.
Same for an app object in eDirectory
..appobject.dept.biz.site.county.state.tree
How to I grab just the .site.county.state.tree OUs?
Sometimes there are 5 OUs after the app object, and sometimes more.
I want, I think, to "start at the end of the string, and grab everything
after the 4th dot from the end," but don't have a clue how to code this.
I'm not a perl newbie, but I'm no expert....and I AM a RegEx idiot!
Here's some of what I've tried:
$string = ".appobject.dept.biz.site.county.state.tree";
$string =~ /\..+\..+\..+/$; # i.e. match a literal dot followed my
anything mult times, followed by another literal dot, followed, etc...
# starting at the end of the string
$string =~ /(\.\W)*/; # \w does NOT match AlphaNum like it's supposed to,
\W DOES, but it's NOT supposed to.
# unless . is an AlphaNum character, but I'm
not sure
And I can't remember the 4,612 other patterns I've tried, or the
accompanying 4,612 hairs I've
yanked from my scalp in the process. :-(
Thank you,
Chris