Home java How to specify a string translation symbol in Regexp?

How to specify a string translation symbol in Regexp?

Author

Date

Category

How to specify a string translation symbol in Regexp and a few more characters # ,!, =,:, Space .
Somehow so?

("#! =: \ N \ r")

Answer 1, Authority 100%

\ N – translation of the line

\ s – one of the symbols of the unicode space and equivalent [\ t \ n \ v \ f \ u \ u00a0 \ u2000 \ u2001 \ u2002 \ u2003 \ u2004 \ u2005 \ u2006 \ u2007 \ u2008 \ u2009 \ u200a \ u200b \ u2028 \ u2029 \ u3000] https://stackoverflow.com/a/2429180
\ u0020 – the Symbol Symbol itself https: // www .cs.tut.fi / ~ jkorpela / chars / spaces.html

\ n \ # \! \ = \: \ s

In the expression itself, the specialists can be recorded so (if I’m not mistaken): [@ # $% ^ & amp; + =]

https://htmlweb.ru/java/regExp.php

Example: https://stackoverflow.com/questions/10664434/escaping -Special-characters-in-java-regular-expressions


Answer 2, Authority 31%

Well, in the first in Java, two slash is set, in this case, \\ s + will designate any number of space characters since the 1st, here and the translation of the lines of spaces also enter. Specifically for this purpose: "# |! | =: | \\ s" .

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions