perl reg expression help.

  • Thread starter Master Chief Petty Officer John-117
  • Start date
M

Master Chief Petty Officer John-117

Hi,
I am looking to compile a regular expression to meet the following req's if anybody hands on with perl can help

1. looking for string 'files' (in a given folder location) i.e. C:\program files\files or /home/files
2. string should match any case (upper/lower and mix)
3. string should occur at the end (whats leading is regardless)
4. if there are multiple occurences (i.e. program files\files) it should match the last one only

Many Thanks
 
C

ccc31807

On Mar 8, 6:16 am, Master Chief Petty Officer John-117
1. looking for string 'files' (in a given folder location) i.e. C:\program files\files or /home/files
2. string should match any case (upper/lower and mix)
3. string should occur at the end (whats leading is regardless)
4. if there are multiple occurences (i.e. program files\files) it should match the last one only

Probably easiest to use grep. This command returns all instances of
"files" contained in any file in the current working directory:

grep files *

That should be enough to get you started. Look for 'case insensitive'
and 'word boundary' switches.

CC.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top