need help with regular expressions
need help with regular expressions
am 24.12.2007 09:53:59 von tsahiasher
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
Re: need help with regular expressions
am 24.12.2007 10:18:47 von rvtol+news
tsahiasher@gmail.com 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."
Re: need help with regular expressions
am 24.12.2007 15:04:38 von Tad J McClellan
tsahiasher@gmail.com 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/"
Re: need help with regular expressions
am 24.12.2007 20:13:53 von jurgenex
tsahiasher@gmail.com 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
Re: need help with regular expressions
am 25.12.2007 17:09:46 von tsahiasher
On Dec 24, 11:18 am, "Dr.Ruud" wrote:
> tsahias...@gmail.com 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