Here you can find the source of toRegEx(String input)
Parameter | Description |
---|---|
input | the input string |
public static String toRegEx(String input)
//package com.java2s; /*/* w w w.jav a2 s. c om*/ * Version: 1.0 * * The contents of this file are subject to the OpenVPMS License Version * 1.0 (the 'License'); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.openvpms.org/license/ * * Software distributed under the License is distributed on an 'AS IS' basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * Copyright 2005 (C) OpenVPMS Ltd. All Rights Reserved. * * $Id$ */ public class Main { /** * Convert the incoming string to a regular expression. This means * escaping the '.' and converting all the '*' to '.*' * * @param input the input string * @return the converted string */ public static String toRegEx(String input) { return input.replace(".", "\\.").replace("*", ".*"); } }