Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: position of first matching regex

by wjw (Priest)
on May 16, 2014 at 23:35 UTC ( [id://1086405]=note: print w/replies, xml ) Need Help??


in reply to position of first matching regex

If you know that your number will be in position 0 or position 1, and that is all you care about, use the '^' to determine if the first character is a number or not. If it is, you will get a match, if it is not, then you know the first character is an non-number...

if ($filename =~ /^[0-9]/) { .... } (untested)

Hope that is helpful....

...the majority is always wrong, and always the last to know about it...
Insanity: Doing the same thing over and over again and expecting different results...

Replies are listed 'Best First'.
Re^2: position of first matching regex
by techtaskers.com (Novice) on May 17, 2014 at 13:50 UTC

    Yes that would work, given the assumptions. What I hope to accomplish is to code a procedure that is less assumptive and more informing. I can run further contingencies based on the location metric.

    I also need to key onto another part of the file name, a letter indexed serialization of the file. These are tutorial slides, and it is important to account for that too.

    Thank you for your reply.

    David

Log In?
Username:
Password:

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

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

    No recent polls found