Results 1 to 3 of 3
Thread: How to work with REGEX in Java
- 03-31-2011, 02:54 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 5
- Rep Power
- 0
How to work with REGEX in Java
I am having hard time trying to set up a regex in Java for this string "\\abc\de\blah.zip\blah" which is a UNC path in my app.
I want to look for "\\abc\de" as the regex string in the above mentioned UNC path. However, when I try this method, it returns "false"
String input = "\\abc\de\blah.zip\blah";
String regex = "\\*de";
boolean isMatch = Pattern.matches(regex, input);
System.out.println(isMatch);
Please help me.
Also, if you have any good ref for REGEX online stuff, please let me know. The websites I read, I still could not understand well about these REGEX:(
Thanks and Regards, KK
- 03-31-2011, 02:58 AM #2
In regex the backslash has special meaning so you need to escape it, twice. Once for the complier, once for the regex engine.
- 03-31-2011, 04:19 AM #3
Similar Threads
-
Specific syntax? java.util.regex.Pattern$Node
By lmhelp2 in forum New To JavaReplies: 1Last Post: 04-09-2010, 11:32 AM -
RegExPlus - Java regex library
By CodesAway in forum Java SoftwareReplies: 5Last Post: 02-28-2010, 08:15 PM -
help with designing Java program:file browser w/ regex search, possibly media player?
By jmd9qs in forum New To JavaReplies: 0Last Post: 11-04-2009, 09:09 PM -
P~ 0.9 : Java-friendly scripting with powerful regex
By p7eregex in forum Java SoftwareReplies: 0Last Post: 12-17-2007, 08:10 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks