net.sf.jmatchparser.util
Class RegexQuoter

java.lang.Object
  extended by net.sf.jmatchparser.util.RegexQuoter

public class RegexQuoter
extends Object

Utility class for quoting regular expressions for matching literal text. This class was very useful in Java 1.4, where Pattern.quote(String) did not exist yet. Nowadays, only its quotePartially(String) function is useful.


Constructor Summary
RegexQuoter()
           
 
Method Summary
static String quote(String expression)
          Deprecated. as of Java 1.5, use Pattern.quote(String) instead
static String quotePartially(String expression)
          Quote an expression partially.
static String quotePartially(String expression, String startDelimiter, String endDelimiter)
          Quote an expression partially.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexQuoter

public RegexQuoter()
Method Detail

quote

@Deprecated
public static String quote(String expression)
Deprecated. as of Java 1.5, use Pattern.quote(String) instead

Quote an expression.

Parameters:
expression - any text
Returns:
a regular expression that matches exactly the input text

quotePartially

public static String quotePartially(String expression)
Quote an expression partially. Parts between « and » are not quoted, but left inside the expression.


quotePartially

public static String quotePartially(String expression,
                                    String startDelimiter,
                                    String endDelimiter)
Quote an expression partially. Parts between startDelimiter and endDelimiter are not quoted, but left inside the expression.



Copyright © 2011. All Rights Reserved.