Why Reg Expression is not being matched our found

I have a couple strings such as this:
999 NO ACCT NUM NET PAY ARR
9830-1800

And I have a regular expression to do a String.Match("\\p{Lower}\\p{Upper}")

However, I seem to be not matching this string: 999 NO ACCT NUM NET PAY ARR

Thoughts?


LVL 1
Corey_819Asked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
You can more easily do that by:

if (s.indexOf(' ') > -1 && s.matches("[\\p{Alnum} ]+"))
0
 
CEHJCommented:
It's quite far off matching

[\\p{Alnum} ]+

would need to be your pattern
0
 
Corey_819Author Commented:
Oh Dugh, I am a gobber. I didnot even think about the 3 9's Let me change. :)
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
CEHJCommented:
If you do that you can change Alnum to Alpha
0
 
Corey_819Author Commented:
I am sorry CEHJ and I really appreciate the help and everthing works but why is it working this way:

97200100
98300100
999 NO ACCT NUM NET PAY ARR
OH    CO TAX ACT NOT ENTERED

These four strings are all passing the regExp match. I want these two 999 NO ACCT NUM NET PAY ARR , OH    CO TAX ACT NOT ENTERED, but not string with all numbers. Thoughts?


0
 
CEHJCommented:
If you must retain a regex, the following would work

(\\w+\\s+\\w+){1,}
0
 
Corey_819Author Commented:
Ah Ha excellent idea. Thanks you have been great help :)
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.