I have a little knowledge of regulars. I need to read how to use regular expressions in java. Tell me, please, that you can read. And the second question: how to create a regular expression in java to replace all characters // and \\ with / ?

    4 answers 4

    A pattern like this:

     Pattern pattern = Pattern.compile("Здесь будет регулярное выражение"); Matcher matcher = pattern.matcher("строка для разбора"); String result = matcher.replaceAll("/"); // строка с результатом (замена всего найденного на "/") 

    Well, and then train to make regExp =)

      Read: first-hand information

      I don’t know how to create a regular expression to replace, but if all your data in java is stored in a variable of type String, you can try using its replace () method.

        Good day!

        If you want to deal with regular expressions, then I would advise you to learn their syntax from Action Script 3.0 help tags, help - everything is clearly described, I learned from them, they are the same as in Java. And then the subtleties of the syntax for calling these regular expressions in Java are pretty chewed up here - the syntax for calling in Java .

        Good luck in learning! :-)

           /* //\\//\ - неэкранированная строка */ String text = "//\\\\//\\"; // экранированная строка String replased = text.replaceAll("\\/\\/|\\\\", "/"); //замена