Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
regex2 - used A-Z in place of A..Z as I've never used the latter before and can't even figure what it would do at the moment

Not what I'd thought it would do! OK, I made a wrong assumption (getting mixed up between array ranges and regex ranges) - you're quite correct, /$[A-Z]^/ is functionally correct.

I tried your suggestion along side the (now correct) regex and exist, with the following results -

Benchmark: timing 10000000 iterations of exist, index, regex... exist: 50 wallclock secs (49.39 usr + 0.01 sys = 49.40 CPU) index: 61 wallclock secs (60.64 usr + 0.00 sys = 60.64 CPU) regex: 85 wallclock secs (83.18 usr + 0.03 sys = 83.21 CPU)

It's interesting that I get a bigger difference between the exist and index versions. I wonder what OS & hardware you're running on? Mine is linux v2.2.18 on a Pentium II 400Mhz with 128Mb RAM.

Pete


In reply to Re: Re: Testing a string for a range of characters by BoredByPolitics
in thread Testing a string for a range of characters by BoredByPolitics

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-19 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found