June 17th, 2010, 04:23 PM
Convert C# RegEx to Java RegEx
I have some RegEx in C#, and i would like use them in java Application, but the c# and Java RegEx are not compatible, so it does a RegEx converter exist?; for more ingo my RegExs are:
Thank you; i have realy need to this.
June 17th, 2010, 05:00 PM
Because Java regexps have to be contained in a String, you need to double your backslashes.
e.g. to match whitespace, put in \\s
to escape a bracket, it's \\]
for a literal backslash character, you need \\\\
June 18th, 2010, 02:45 AM
I must replace \ by \\??
hy; thanks for your answer; but i haven't understand you; what i should do, i sould replace \ by \\; i have try this, but i have an error whene i execute the program.
June 18th, 2010, 05:48 AM
What's the error? And what does your regexp look like now?
June 18th, 2010, 06:01 AM
Error whene creating the Pattern
Hi, the error that i have, is in the creation of the pattern, i m in the ofiice now, and this project is at home, i will post the error to night;
For the new RegEx, it's exactly the first one, but i have just replace \ with \\, i have not modify the rest.
Are you sure that is the only changes that i have to do??
Thanks for you.
June 18th, 2010, 06:21 AM
You'll also have to escape the double-quotes you have in your pattern by placing a single backslash before them.
June 18th, 2010, 04:57 PM
It don work!!
Hi, i have modify my regex but they still dont working the error is :
java.lang.IllegalStateException: No match found
and it happens whene i try to do this
it is stange because whene i try this
MyMacherObject.groupCount(); it render me '5' in my case, so it is not null;
So; i think that the content of myMatcherObject is not cerrect; and this is due to my regEx.
June 19th, 2010, 08:37 AM
What does your regexp look like now?
And what data are you applying it to?
Preferably post these as executable Java code. Thanks.
June 19th, 2010, 06:08 PM
My new regex!
hi; and thanks for all your answers.
the first regex that my program exécute is:
and i applay this regex to this string:
function nettoyerSource($suppcom, $destination)
if(!file_exists($dossier)) mkdir($dossier, '0777', true);
return (bool) $ecriture;
the program that i develope is an application that obfuscate php code.
the rest of reges is not exécuted because the the first one bugs; so i have not send the rest of regex.
Thanks a lot.
Problem resolved, the regex were correct, i have doing some errors whene copying and pasting;
Thank you for all our answers.