?
Solved

Retrieving a file pattern format from an array

Posted on 2005-03-23
4
Medium Priority
?
202 Views
Last Modified: 2010-03-31
Hi Experts, I have an array of strings which stores xml files.

I would like to be able to retrieve files with a certain format.

//Current array data
KB_Java.xml
KB_Template.xml
kb00001.xml
kb00002.xml

I would like to retrieve the following.
kb00001.xml
kb00002.xml

My current method is looping through each file entry within the array, assign it to a string and then i wish to say something like,

If(stringFile(i) == certain pattern) then //matching kb00001/kb00002/kb00003 etc ..
    add unique entry to another uniqueEntries array



Very hard and as of yet my research has found nothing on this :o(

Any ideas?


0
Comment
Question by:dev-ngps7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 1000 total points
ID: 13611369
>> If(stringFile == certain pattern)

if (stringFile.matches("kb\\d{5}\\.xml"))
0
 
LVL 37

Expert Comment

by:zzynx
ID: 13611383
Explanation: kb followed by exactly 5 digits followed by .xml
0
 

Author Comment

by:dev-ngps7
ID: 13611578
Just what i was after, cheers zzync :o)
0
 
LVL 37

Expert Comment

by:zzynx
ID: 13611611
Thanks :°)
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question