On 4/18/06, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> From: "Jay Savage" <[EMAIL PROTECTED]>
> > On 4/14/06, JupiterHost.Net <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > Timothy Johnson wrote:
> > > > Will the string always have the two quotes in the same place and
> > > > only one per string? W
Jay Savage wrote:
> On 4/14/06, JupiterHost.Net <[EMAIL PROTECTED]> wrote:
>>
>>Timothy Johnson wrote:
>>>Will the string always have the two quotes in the same place and only
>>>one per string? What about something like this?
>>>
>>>/.*?\{([^\}]*)\}(?=.*")/gi
>>I tested it out and it appears to b
Timothy Johnson schreef:
> /.*?\{([^\}]*)\}(?=.*")/gi
There is no need to escape a } in a character class.
Something like
[^x]*x
can also be written as
.*?x
The "/i" modifier is superfluous. The last .* can also be minimalized.
So an alternative is:
/ [{] (.*?) [}] (?=.*?") /xg
Jay Savage wrote:
On 4/14/06, JupiterHost.Net <[EMAIL PROTECTED]> wrote:
Timothy Johnson wrote:
Will the string always have the two quotes in the same place and only
one per string? What about something like this?
/.*?\{([^\}]*)\}(?=.*")/gi
I tested it out and it appears to be perect!
On 4/14/06, JupiterHost.Net <[EMAIL PROTECTED]> wrote:
>
>
> Timothy Johnson wrote:
> > Will the string always have the two quotes in the same place and only
> > one per string? What about something like this?
> >
> > /.*?\{([^\}]*)\}(?=.*")/gi
>
> I tested it out and it appears to be perect! Than
-Original Message-
From: JupiterHost.Net [mailto:[EMAIL PROTECTED]
Sent: Friday, April 14, 2006 12:15 PM
To: beginners@perl.org
Subject: Re: regex matching conditionally
>Timothy Johnson wrote:
>> Will the string always have the two quotes in the same place and only
>>
Timothy Johnson wrote:
Will the string always have the two quotes in the same place and only
one per string? What about something like this?
/.*?\{([^\}]*)\}(?=.*")/gi
I tested it out and it appears to be perect! Thank Mr. Johnson :)
I love when I learn a new tidbit!
--
To unsubscribe, e-
Not what you asked for, but probably more correct:
my @matches;
use Regexp::Common;
my @quoted = ($string =~ /$RE{quoted}/g);
foreach my $quoted ( @quoted ) {
push( @matches, ($quoted =~ /$RE{balanced}{-parens=>'{}'}/g) );
}
print join "\n", @matches;
Thanks, it was the same sort of i
JupiterHost.Net wrote:
Howdy list,
I'm trying to see if I can do this in one regex instead of multiple
stage, mainly for educational purposes since I already have it in
multipel steps.
I am trygin to get each string between { and } where the {} occurs
between double quotes. So with
"file
Timothy Johnson wrote:
Will the string always have the two quotes in the same place and only
Well, it could have multiple {} inside or outside of multiple "" AFAIK.
one per string? What about something like this?
/.*?\{([^\}]*)\}(?=.*")/gi
That does work on that exact string, I'll have
Will the string always have the two quotes in the same place and only
one per string? What about something like this?
/.*?\{([^\}]*)\}(?=.*")/gi
-Original Message-
From: JupiterHost.Net [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 13, 2006 5:16 PM
To: beginners@perl.org
Subject:
11 matches
Mail list logo