Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8268297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:50:12+00:00 2026-06-08T05:50:12+00:00

I am using this code in Android to validate Password. But now want to

  • 0

I am using this code in Android to validate Password. But now want to use this expression in BB. But it is not working and giving exception

This is Android Code

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public static boolean isUserPassValid(String userPass) {

        boolean isValid = false;
        try {
            String expression = "^.*(?=.{5,30})(?=.*\\d)(?=.*[a-zA-z]).*";
            CharSequence inputStr = userPass;

            Pattern pattern = Pattern.compile(expression,
                    Pattern.CASE_INSENSITIVE);
            Matcher matcher = pattern.matcher(inputStr);
            if (matcher.matches()) {
                isValid = true;
            }
        } catch (Exception e) {
            Log.e(TAG, "isUserPassValid Message = " + e.toString());
            e.printStackTrace();
        }
        return isValid;
    }

This is BB code that I am trying to validate in Java now

import com.sun.org.apache.regexp.internal.RE;


public class Test {

    /**
     * @param args
     */
    public static void main(String[] args) {
        isValidPassword("Arsla");

    }

    public static boolean isValidPassword(String text) {
        System.out.println(" password for varefication is : " + text);
        boolean isValid = false;
        String expression = "^.*(?=.{5,30})(?=.*\\d)(?=.*[a-zA-z]).*$";
        String username = text;
        RE regx = new RE(expression);
        try {
            isValid = regx.match(username);
            System.out.println("password msps to the re " + isValid);

        } catch (Exception e) {

        }
        return isValid;
    }

}

Here is Exception

Exception in thread "main" com.sun.org.apache.regexp.internal.RESyntaxException: Syntax error: Missing operand to closure
    at com.sun.org.apache.regexp.internal.RECompiler.syntaxError(Unknown Source)
    at com.sun.org.apache.regexp.internal.RECompiler.terminal(Unknown Source)
    at com.sun.org.apache.regexp.internal.RECompiler.closure(Unknown Source)
    at com.sun.org.apache.regexp.internal.RECompiler.branch(Unknown Source)
    at com.sun.org.apache.regexp.internal.RECompiler.expr(Unknown Source)
    at com.sun.org.apache.regexp.internal.RECompiler.terminal(Unknown Source)
    at com.sun.org.apache.regexp.internal.RECompiler.closure(Unknown Source)
    at com.sun.org.apache.regexp.internal.RECompiler.branch(Unknown Source)
    at com.sun.org.apache.regexp.internal.RECompiler.expr(Unknown Source)
    at com.sun.org.apache.regexp.internal.RECompiler.compile(Unknown Source)
    at com.sun.org.apache.regexp.internal.RE.<init>(Unknown Source)
    at com.sun.org.apache.regexp.internal.RE.<init>(Unknown Source)
    at Test.isValidPassword(Test.java:19)
    at Test.main(Test.java:10)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:50:15+00:00Added an answer on June 8, 2026 at 5:50 am

    Maybe the BB regex implementation does not support look arounds.

    Try executing a simple look around example on both android and blackberry and see if it
    works. For example

    String expression = "A(?=B)"; // only matches B if it follows an A
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the Android Eclair 2.1 platform. The working behind this code is,
why SqlLite query in android produce Nullpointer exception I am using this code public
I have been using this code to parse xml till now. Its was working
I wrote a code using this tutorial http://marakana.com/forums/android/examples/311.html It is working fine except the
I'm using this code to post on Facebook, but it does not work with
I am using this code for on android just trying to convert string to
I'm working on a picture select/crop program and using this code below: http://www.androidworks.com/crop_large_photos_with_android/comment-page-1#comment-969 As
I have a problem with my code in Android. I am using this to
I am creating an archive on Android using the code like this: OutputStream os
everyone. This is a piece of code from using sqlite in android tutorial: return

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.