Thread: Regex pattern
View Single Post
  #1 (permalink)  
Old 12-10-2007, 08:34 PM
ravian ravian is offline
Senior Member
 
Join Date: Nov 2007
Posts: 115
ravian is on a distinguished road
Regex pattern
I am using Regex API to filter some text. I want to find the following pattern:
*-*.html
A dash has to appear in the file name.

Code:
String patternStr = "[A-Za-z0-9]*.html"; Pattern pattern = Pattern.compile(patternStr); String str1; while ((str1 = in.readLine()) != null) { Matcher matcher = pattern.matcher(str1); while(matcher.find()) { int start = matcher.start(); int end = matcher.end(); System.out.println(str1.subSequence(start, end)); }
I don't know how to include dash (-) in the pattern string.
Reply With Quote
Sponsored Links