Forum Stats

  • 3,726,717 Users
  • 2,245,245 Discussions
  • 7,852,367 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How can you escape a String in order to make it reg exp parseable?

Use case: Say, that you are programatically generating a bunch of files for which you use as prefix the file's name, because you need a way to know which generated files relates to which source file (which you would do then with a reg exp), but, for example, on a wikipedia entry such as:

Terreur_(Révolution_française)

apparently the "(" and ")" and also the French characters é, ç, seem to be problematic while running a reg exp in java

Algorithm is working fine with all other cases. Java Training

There is a way to escape html mark up in urls. Is there a similar way to espace strings intended to be used for regular expressions in Java?

Tagged:
Sign In or Register to comment.