Package org.apache.oro.text.perl

Examples of org.apache.oro.text.perl.Perl5Util


    */
    protected String stripComments(String emailStr)  {
     String input = emailStr;
     String result = emailStr;
     String commentPat = "s/^((?:[^\"\\\\]|\\\\.)*(?:\"(?:[^\"\\\\]|\\\\.)*\"(?:[^\"\\\\]|\111111\\\\.)*)*)\\((?:[^()\\\\]|\\\\.)*\\)/$1 /osx";
     Perl5Util commentMatcher = new Perl5Util();
     result = commentMatcher.substitute(commentPat,input);
     // This really needs to be =~ or Perl5Matcher comparison
     while (!result.equals(input)) {
        input = result;
        result = commentMatcher.substitute(commentPat,input);
     }
     return result;

    }
View Full Code Here


    /**
     * Returns true if the ISBN is formatted properly.
     */
    private boolean isValidPattern(String isbn) {
        return new Perl5Util().match(ISBN_PATTERN, isbn);
    }
View Full Code Here

    public String[] process(byte[] data, int offset, int length, long bitmask, char comparator,
        String mimeType, Map params)
    {
        log.debug("processing stream data");

        Perl5Util util = new Perl5Util();

        try {
            BOMInputStream bomIn = new BOMInputStream(new ByteArrayInputStream(data), ByteOrderMark.UTF_8, ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_16BE);
            if (bomIn.hasBOM()) {
                return new String[] { "text/plain" };
            }
        } catch (IOException e) {
            log.error("TextFileDetector: error detecting byte order mark");
        }

        try {
            String s = new String(data, "UTF-8");

            if (!util.match("/[^[:ascii:][:space:]]/", s)) {
                return new String[] { "text/plain" };
            }
        } catch (UnsupportedEncodingException e) {
            log.error("TextFileDetector: failed to process data");
        }
View Full Code Here

        log.debug("testRegex()");

        String test = new String(match.getTest().array());
        char comparator = match.getComparator();

        Perl5Util utility = new Perl5Util();
        log.debug("testRegex(): searching for '" + test + "'");

        if (comparator == '=') {
            if (utility.match(test, text)) {
                return true;
            } else {
                return false;
            }
        } else if (comparator == '!') {
            if (utility.match(test, text)) {
                return false;
            } else {
                return true;
            }
        }
View Full Code Here

      final BufferedReader bufferedReader = new BufferedReader(
          new InputStreamReader(in));

      String line = null;
      while ((line = bufferedReader.readLine()) != null) {
        final Perl5Util util = new Perl5Util();
        final List<String> rankStrings = new ArrayList<String>();
        util.split(rankStrings, "/\\s*,\\s*/", line);

        int product = 1;
        // First 5 columns are card ranks
        for (int i = 0; i < 5; i++) {
          product *= Rank.valueOf(rankStrings.get(i)).getPrime();
View Full Code Here

   * Build the regular expression needed to parse log entries
   * 
   */
  protected void initialize() {
   
    util = new Perl5Util();
    exceptionCompiler = new Perl5Compiler();
    exceptionMatcher = new Perl5Matcher();

    currentMap = new HashMap();
    additionalLines = new ArrayList();
View Full Code Here

    */
    public static boolean matchRegexp(String value, String regexp) {
        boolean match = false;

        if (regexp != null && regexp.length() > 0) {
            Perl5Util r = new Perl5Util();
            match = r.match(getDelimittedRegexp(regexp), value);
        }

        return match;
    }
View Full Code Here

            String userPat = getDelimittedRegexp("^" + word + "(\\." + word + ")*$");
            String domainPat =
                getDelimittedRegexp("^" + atom + "(\\." + atom + ")*$");
            String atomPat = getDelimittedRegexp("(" + atom + ")");

            Perl5Util matchEmailPat = new Perl5Util();
            Perl5Util matchUserPat = new Perl5Util();
            Perl5Util matchIPPat = new Perl5Util();
            Perl5Util matchDomainPat = new Perl5Util();
            Perl5Util matchAtomPat = new Perl5Util();
            Perl5Util matchAsciiPat = new Perl5Util();

            boolean ipAddress = false;
            boolean symbolic = false;

            if (!matchAsciiPat.match(legalAsciiPat, value)) {
                return false;
            }

            // Check the whole email address structure
            bValid = matchEmailPat.match(emailPat, value);
View Full Code Here

     *  <tr><td>p4.user</td><td>User</td></tr>
     *  </table>
     */
    public void init() {

        util = new Perl5Util();

        //Get default P4 settings from environment - Mark would have done something cool with
        //introspection here.....:-)
        String tmpprop;
        if ((tmpprop = getProject().getProperty("p4.port")) != null) {
View Full Code Here

        failOnError = fail;
    }

    public void init() {

        util = new Perl5Util();

        //Get default P4 settings from environment - Mark would have done something cool with
        //introspection here.....:-)
        String tmpprop;
        if ((tmpprop = project.getProperty("p4.port")) != null) {
View Full Code Here

TOP

Related Classes of org.apache.oro.text.perl.Perl5Util

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.