Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

FilePattern

 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

with a file pattern, i try to find some file...

example: TRX-SOUS-SYST20100927211610.TXT




when i debug, i see name = "TRX-SOUS-SYST20100927211610.TXT"
so i don't understand, why this pattern don't work: "TRX-SOUS-SYST.*20100927*.TXT"

any idea?


edit:

String pre = "TRX-SOUS-SYST.*";
String userInput = "20100927";
String post="*.TXT";

become

String pre = "TRX-SOUS-SYST";
String userInput = "20100927";
String post=".*TXT";

and that work fine
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the name is not an exact match against the regex pattern, which I guess you've already figured out.
To understand why, have a look at the documentation of java.util.regex.Pattern, specifically the meaning and use of the . and * special characters.

 
Hold that thought. Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic