Results 1 to 3 of 3
Thread: How to work with REGEX in Java
- 03-31-2011, 02:54 AM #1Member
- Join Date
- Feb 2011
- Rep Power
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);
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
- By lmhelp2 in forum New To JavaReplies: 1Last Post: 04-09-2010, 11:32 AM
- By CodesAway in forum Java SoftwareReplies: 5Last Post: 02-28-2010, 09:15 PM
- By jmd9qs in forum New To JavaReplies: 0Last Post: 11-04-2009, 10:09 PM
- By p7eregex in forum Java SoftwareReplies: 0Last Post: 12-17-2007, 09:10 PM