Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Search for account number in a file name

by hdb (Monsignor)
on Jun 21, 2013 at 05:28 UTC ( [id://1040071]=note: print w/replies, xml ) Need Help??


in reply to Search for account number in a file name

Do you have information about the structure of the file name? If (I'm guessing) it is a combination of fields joined by underscores, and you know that the first part is the account number with leading zeros followed by two digits, then you should make use of this knowledge. For example,

  1. split along the underscores,
  2. take the first field,
  3. remove the leading zeroes and the last two digits
  4. and compare against the account number you want to find.
Even if this is slower than other approaches, it will avoid false matches. With respect to account numbers I would think that accuracy is more important than performance.

If you want you can encode this into a regex like /^0*(\d+)\d\d_/ (still based on my guess above).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1040071]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found