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.
Yeah, I should have mentioned that. I changed it to xmsg and formatted
it "Best Practice"-wise so I could rea dit better.
* Using "^" in a class to limit a search is usually less efficient
than doing a 'non-greedy" search.
Good idea.
* Curly braces aren't metacharacters. they only need to be escaped
when they could be mistaken for range delimiters.
Good point.
I escapsed them because I like to do regex like:
m{whatever}
or s{foo}{bar}
If you're going through a few thousand iterations, you'll be happier
with something like:
/.*?{(\.*?)}(?=.*")/go
Thanks Jay, It doesn't appear to work right off but I'll study it a bit
and see what I did wrong, danke!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>