need help with regular expressions

T

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
 
D

Dr.Ruud

(e-mail address 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))/
 
J

Jürgen Exner

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
 
T

tsahiasher

(e-mail address removed) schreef:



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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top