Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > need help with regular expressions

Reply
Thread Tools

need help with regular expressions

 
 
tsahiasher@gmail.com
Guest
Posts: n/a
 
      12-24-2007
hi,
i need the correct regular expression to set the unnamed variable $1
to any of "FantasyMFG", "Fantasy.NET", or "FantasyACC" in the
following path:

FantasyMFG/tags/2.1.16

(where "FantasyMFG" may be replaced with any of the others)

this is for a system we are using. i've been battling this for a while
now, but there's a limit to how much time i can dedicate for this.

thanks,
tsahi
 
Reply With Quote
 
 
 
 
Dr.Ruud
Guest
Posts: n/a
 
      12-24-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) schreef:

> i need the correct regular expression to set the unnamed variable $1
> to any of "FantasyMFG", "Fantasy.NET", or "FantasyACC" in the
> following path:
>
> FantasyMFG/tags/2.1.16
>
> (where "FantasyMFG" may be replaced with any of the others)
>
> this is for a system we are using. i've been battling this for a while
> now, but there's a limit to how much time i can dedicate for this.


So what have you tried sofar?
(show minimal but complete code, that we can run)

Maybe this helps:

/(Fantasy(?:MFG|\.NET|ACC))/

--
Affijn, Ruud

"Gewoon is een tijger."

 
Reply With Quote
 
 
 
 
Tad J McClellan
Guest
Posts: n/a
 
      12-24-2007
(E-Mail Removed) <(E-Mail Removed)> wrote:

> i need the correct regular expression to set the unnamed variable $1



$1 has a name. It's name is "dollar one".


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      12-24-2007
(E-Mail Removed) wrote:
>i need the correct regular expression to set the unnamed variable $1
>to any of "FantasyMFG", "Fantasy.NET", or "FantasyACC" in the
>following path:
>
>FantasyMFG/tags/2.1.16
>
>(where "FantasyMFG" may be replaced with any of the others)


Well, does it really have to be a RE and $1? It would be much easier and
probably faster to use a simple
(split '/', 'FantasyMFG/tags/2.1.16')[0];
instead.

jue
 
Reply With Quote
 
tsahiasher@gmail.com
Guest
Posts: n/a
 
      12-25-2007
On Dec 24, 11:18 am, "Dr.Ruud" <(E-Mail Removed)> wrote:
> (E-Mail Removed) schreef:
>
> > i need the correct regular expression to set the unnamed variable $1
> > to any of "FantasyMFG", "Fantasy.NET", or "FantasyACC" in the
> > following path:

>
> > FantasyMFG/tags/2.1.16

>
> > (where "FantasyMFG" may be replaced with any of the others)

>
> > this is for a system we are using. i've been battling this for a while
> > now, but there's a limit to how much time i can dedicate for this.

>
> So what have you tried sofar?
> (show minimal but complete code, that we can run)
>


this isn't for my code. it's for a config file of a Perl program i'm
using (Scmbug, if you are familiar with it). so far i tried

Fantasy[\s\.\w]+ (seems to work, but the Scmbug developer said "it
won't set the $1 unamed variable")

(Fantasy.+?)/ and (.+?)/ (for some reason Scmbug took these literaly
and not as REs)

> Maybe this helps:
>
> /(Fantasy(?:MFG|\.NET|ACC))/
>


i'll try that and see if it works.

Tsahi
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with regular expressions wrapper function mike ASP General 2 10-03-2006 08:09 AM
Add custom regular expressions to the validation list of available expressions Jay Douglas ASP .Net 0 08-15-2003 10:19 PM
Regular Expressions....HELP! Stephajn Craig ASP .Net 1 07-16-2003 06:56 PM
Re: Help with regular expressions. Chris R. Timmons ASP .Net 0 07-04-2003 10:49 PM
Re: Help with regular expressions. David Waz... ASP .Net 0 07-04-2003 08:59 PM



Advertisments