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! Thank Mr. Johnson :)
>>
>>I love when I learn a new tidbit!
>
> A couple of things here.
>
> * You're not matching anything alphabetic here, so the "i" modifier is
> superfluous.
> * Using "^" in a class to limit a search is usually less efficient
> than doing a 'non-greedy" search.
> * Curly braces aren't metacharacters. they only need to be escaped
> when they could be mistaken for range delimiters.
>
> If you're going through a few thousand iterations, you'll be happier
> with something like:
>
> /.*?{(\.*?)}(?=.*")/go
The /o modifier only applies if you have variables in the regular expression.
perldoc -q /o
The .*? at the beginning is superfluous. You have a backslash in front of the
'.' character which means you want to match only a literal '.' character.
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>