[lug] Regex Help

Walter Pienciak wpiencia at thunderdome.ieee.org
Fri Jul 8 15:07:51 MDT 2011


If you are working with a string that includes the hostname
(sounds like it) try pulling the hostname into the string match

hostname\/somepath\/   

Walter

On Fri, Jul 08, 2011 at 03:03:54PM -0600, George Sexton wrote:
> Not to be stupid or anything, but if I understood regular expressions well
> enough to use this, I wouldn't have asked for help.
> 
> I'm using an application that matches regular expressions in URLs.
> 
> I'd like it to match
> 
> /somepath/*
> 
> But not
> 
> /somethingelse/somepath/*
> 
> I can write an expression to match /somepath/*. The problem is it's matching
> the second thing which I don't want.
> 
> I don't get to write a lot of code. 
> 
> I don't know what the host name will be. It might be a fqdn, might be an IP
> Address.
> 
> The input has the full URL syntax:
> 
> Scheme:hostname/path/
> 
> 
> 
> George Sexton
> MH Software, Inc.
> 303 438-9585
> www.mhsoftware.com
> 
> 
> > -----Original Message-----
> > From: lug-bounces at lug.boulder.co.us [mailto:lug-
> > bounces at lug.boulder.co.us] On Behalf Of Chip Atkinson
> > Sent: Friday, July 08, 2011 2:44 PM
> > To: Boulder (Colorado) Linux Users Group -- General Mailing List
> > Subject: Re: [lug] Regex Help
> > 
> > How about this:
> > 
> > http://txt2re.com/
> > 
> > 
> > 
> > On Fri, 8 Jul 2011, George Sexton wrote:
> > 
> > > I'm just dying on a regular expression here. I'm always rotten. If
> > someone
> > > could help me out I would appreciate it.
> > >
> > >
> > >
> > > I'm looking for a regex that will match:
> > >
> > >
> > >
> > > http://some.host/specificpath/
> > >
> > >
> > >
> > > but not
> > >
> > >
> > >
> > > http://some.host/otherjunk/specificpath/
> > >
> > >
> > >
> > > I'd really appreciate any help I can get.
> > >
> > >
> > >
> > >
> > >
> > > George Sexton
> > >
> > > MH Software, Inc.
> > >
> > > 303 438-9585
> > >
> > > www.mhsoftware.com
> > >
> > >
> > >
> > >
> > 
> > _______________________________________________
> > Web Page:  http://lug.boulder.co.us
> > Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> > Join us on IRC: irc.hackingsociety.org port=6667
> > channel=#hackingsociety
> 
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety



More information about the LUG mailing list